#include using namespace std; const int M=1001; int T,n,A[M],B[M]; void Solve(){ scanf("%d",&n); int ma=0; for(int i=1;i<=n;i++){ scanf("%d",&A[i]); if(A[i])ma=max(ma,i); } for(int i=1;i<=n;i++){ scanf("%d",&B[i]); if(B[i])ma=max(ma,i); } int a=A[ma],b=B[ma]; int c=__gcd(a,b); a/=c,b/=c; printf("%d/%d\n",a,b); } int main(){ scanf("%d",&T); while(T--)Solve(); }