#include // #include #define rng(a) a.begin(),a.end() #define rrng(a) a.rbegin(),a.rend() #define INF 2000000000000000000 #define ull unsigned long long #define ll long long #define ld long double #define pll pair using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> T; for (ll testcase = 0; testcase < T; ++testcase) { ll V, X, Fo, Fi, Q, R; cin >> V >> X >> Fo >> Fi >> Q >> R; ll diff_per_turn = -Q * Fo + R * Fi; if (diff_per_turn > 0) { cout << "Overflow" << "\n"; } else if (diff_per_turn < 0) { cout << "Zero" << "\n"; } else { if ((Fi - Fo) * R + X > V) { cout << "Overflow" << "\n"; } else { cout << "Safe" << "\n"; } } } }