using namespace std; #include typedef long long ll; typedef long double ld; typedef string str; template using v = vector; template using vv = vector>; template using vvv = vector>>; template inline void errv(T &v) { for(auto x : v) cerr << x << " "; cerr << endl; } inline void errv(vector &v) { for(auto x : v) cerr << (x ? 1 : 0) << " "; cerr << endl; } template inline void dbgn(T x) { cerr << x << endl; } template inline void dbgn(vector &v) { errv(v); } template inline void dbgn(vector> &m) { for(auto &v : m) errv(v); } template inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } template inline T sum(vector &a) { T ret{}; for(auto &i : a) ret += i; return ret; } template inline T min(vector &a) { T ret = a[0]; for(auto &i : a) chmin(ret, i); return ret; } template inline T max(vector &a) { T ret = a[0]; for(auto &i : a) chmax(ret, i); return ret; } template struct modint { modint(ll v = 0) : value(normalize(v)) { } ll val() const { return value; } void normalize() { value = normalize(value); } ll normalize(ll v) { if(v <= mod && v >= -mod) { if(v < 0) v += mod; return v; } if(v > 0 && v < 2 * mod) { v -= mod; return v; } if(v < 0 && v > -2 * mod) { v += 2 * mod; return v; } v %= mod; if(v < 0) v += mod; return v; } modint &operator=(ll v) { value = normalize(v); return *this; } bool operator==(const modint &o) const { return value == o.val(); } bool operator!=(const modint &o) const { return value != o.val(); } const modint &operator+() const { return *this; } const modint &operator-() const { return value ? mod - value : 0; } const modint operator+(const modint &o) const { return value + o.val(); } modint &operator+=(const modint &o) { value += o.val(); if(value >= mod) value -= mod; return *this; } const modint operator-(const modint &o) const { return value - o.val(); } modint &operator-=(const modint &o) { value -= o.val(); if(value < 0) value += mod; return *this; } const modint operator*(const modint &o) const { return (value * o.val()) % mod; } modint &operator*=(const modint &o) { value *= o.val(); value %= mod; return *this; } const modint operator/(const modint &o) const { return operator*(o.inv()); } modint &operator/=(const modint &o) { return operator*=(o.inv()); } const modint pow(ll n) const { modint ans = 1, x(value); while(n > 0) { if(n & 1) ans *= x; x *= x; n >>= 1; } return ans; } const modint inv() const { ll a = value, b = mod, u = 1, v = 0; while(b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } return u; } friend ostream &operator<<(ostream &os, const modint &x) { return os << x.val(); } template friend modint operator+(T t, const modint &o) { return o + t; } template friend modint operator-(T t, const modint &o) { return -o + t; } template friend modint operator*(T t, const modint &o) { return o * t; } template friend modint operator/(T t, const modint &o) { return o.inv() * t; } private: ll value; }; #define d(x) dbgn(x); #define rep(i, c, n) for(int i = c; i < n; ++i) #define repa(i, a) for(auto i : a) #define so(v) sort(v.begin(), v.end()) #define rso(v) sort(v.rbegin(), v.rend()) using P = pair; using Dijkstra = priority_queue, greater

>; // using mint = modint<1000000007>; using mint = modint<998244353>; const ll INF = 1LL << 60; const ll MOD = 998244353; // const ll MOD = 1000000007; int dx[8] = {0, 1, 0, -1, -1, -1, 1, 1}; int dy[8] = {1, 0, -1, 0, -1, 1, -1, 1}; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t--) { ll v, x, fo, fi, q, r; cin >> v >> x >> fo >> fi >> q >> r; if(x + (fi - fo) * r >= v) { cout << "Overflow" << endl; continue; } ll a = (fi - fo) * r; ll b = fo * (q - r); if(a > b) { cout << "Overflow" << endl; } else if(a < b) { cout << "Zero" << endl; } else { cout << "Safe" << endl; } } }