#include using namespace std; const int N = 1100; int a[N], b[N]; int gcd(int x, int y){ return (!y)?x:gcd(y, x % y); } int main(){ //freopen("a.in", "r", stdin); //freopen("a.out", "w", stdout); int i, j, k, T, n; scanf("%d", &T); while (T--){ scanf("%d", &n); for (i = 1; i <= n; i++){ scanf("%d", &a[i]); } for (i = 1; i <= n; i++){ scanf("%d", &b[i]); } for (i = n; i >= 1; i--){ if ((a[i]) || (b[i])){ if ((a[i] != 0) && (b[i] == 0)){ printf("1/0\n"); } else if (a[i] == 0){ printf("0/1\n"); } else{ int d = gcd(a[i], b[i]); printf("%d/%d\n", a[i] / d, b[i] / d); } break; } } } return 0; }