//determined #include #include #include #include #include #include #include #define set0(x) memset(x,0,sizeof(x)) #define debug(x) cerr<<#x<<'='< void read(T &x){ x = 0;char ch = getchar();int f = 1; while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}; while(isdigit(ch)){x = x*10+ch-48;ch=getchar();} x*=f; } ll gcd(ll a,ll b){ if(b == 0)return a; return gcd(b,a%b); } int T,n,a[1010],b[1010]; int main(){ read(T); while(T--){ read(n); for(int i=0;i=0;i--){ if(a[i]>0 || b[i]>0){ int dd = gcd(a[i],b[i]); a[i]/=dd; b[i]/=dd; cout<