#include #include using namespace std; /* int main() { int t; cin >> t; while (t--) { int n; cin >> n; int ma = -1e9, mb = 1e9; for (int i = 1; i <= n; i++) { int a, b; cin >> a >> b; ma = max(ma, a); mb = min(mb, b); } int ans = ma - mb; if (ans <= 0)cout << 0 << endl; else cout << (ans - 1) / 2 + 1 << endl; } } */ int gcd(int a, int b) { return b ? gcd(b, a%b) : a; } int a[1010], b[1010]; int main() { int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++)cin >> a[i]; for (int i = 1; i <= n; i++)cin >> b[i]; for (int i = n; i >= 1; i--) { if (a[i] == 0 && b[i] == 0)continue; if (a[i] == 0)cout << "0/1" << endl; if (b[i] == 0)cout << "1/0" << endl; if (a[i] != 0 && b[i] != 0) { int gcd1 = gcd(a[i], b[i]); cout << a[i] / gcd1 << "/" << b[i] / gcd1 << endl; } break; } } }