#include using namespace std; int T,n,a[1010],b[1010],f; int gcd(int a,int b){ if(!b) return a; return gcd(b,a%b); } int main(){ cin>>T; while(T--){ f=0; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=1;i<=n;i++) scanf("%d",&b[i]); for(int i=n;i>=1;i--){ if(!(a[i]+b[i])) continue; if(!a[i]&&b[i]){f=1;break;} if(a[i]&&!b[i]){f=2;break;} int s=gcd(a[i],b[i]);a[i]/=s,b[i]/=s; printf("%d/%d\n",a[i],b[i]); break; } if(f==1) printf("0/1\n"); if(f==2) printf("1/0\n"); } return 0; } /* 3 2 0 2 1 0 2 1 0 0 2 3 2 4 0 1 2 0 */