#include #define N 1005 using namespace std; int n,m,a[N],b[N],c1[N],c2[N],tot1,tot2; bool bo; signed main(){ int T; scanf("%d",&T); while(T--){ bo=1;tot1=tot2=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=1;i<=n;i++) if(a[i]!=0)c1[++tot1]=i; for(int i=1;i<=n;i++) if(b[i]!=0)c2[++tot2]=i; if(c1[tot1]>c2[tot2]){puts("1/0");continue;} else if(c1[tot1]