#include #define cir(x) memset(x,0,sizeof(x)) using namespace std; const int N = 1e3+10; int f[N],g[N]; int n,T,m; int main(){ scanf("%d",&T); while(T--){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",f+i); for(int i=1;i<=n;i++) scanf("%d",g+i); for(int i=n;i>=1;i--) { if(f[i]!=0 || g[i]!=0){ if(f[i] == 0){ printf("0/1\n"); } else if(g[i] == 0){ printf("1/0\n"); }else{ int d = __gcd(f[i],g[i]); printf("%d/%d\n",f[i]/d,g[i]/d); } break; } } } return 0; }