//12252024832524 #include #include #define Min(x,y) (xy?x:y) using namespace std; typedef long long LL; const int MAXN = 1005; int f[MAXN],g[MAXN]; int Read() { int x1 = 0,f1 = 1;char c1 = getchar(); while(c1 > '9' || c1 < '0'){if(c1 == '-')f1 = -1;c1 = getchar();} while(c1 >= '0' && c1 <= '9'){x1 = (x1*10) + (c1^48);c1 = getchar();} return x1 * f1; } int gcd(int x,int y) { if(!y) return x; return gcd(y,x%y); } int main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); for(int T = Read(); T ;-- T) { int n = Read(); int a,b; for(int i = 1;i <= n;++ i) f[i] = Read(); for(int i = 1;i <= n;++ i) g[i] = Read(); for(int i = n;i >= 1;-- i) { a = f[i]; b = g[i]; if(!a && !b) continue; int G = gcd(a,b); printf("%d/%d\n",a/G,b/G); break; } } return 0; }