#include using namespace std; int a[1001],b[1001]; int gcd(int a,int b){ return b==0?a:gcd(b,a%b); } int main(){ int t; scanf("%d",&t); while(t--){ int n; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); 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]==0){ printf("1/0\n"); break; } if(a[i]==0&&b[i]){ printf("0/1\n"); break; } if(a[i]&&b[i]){ int t=gcd(a[i],b[i]); printf("%d/%d\n",a[i]/t,b[i]/t); break; } } } return 0; }