#include //g++ -std=c++11 1.cpp using namespace std; typedef long long ll ; typedef pair pii; typedef vector vi; typedef vector vll; const ll INF = 1LL << 60; string solve(){ ll V,X,F0,Fi,Q,R; cin >> V >> X >> F0>> Fi >> Q >> R; //k = 0 ll flag0 = (Fi-F0) * R + X; if (flag0 > V){ return "Overflow"; }else if(flag0 < 0){ return "Zero"; } //R < r <= Q ll flag1 = Fi * R-F0 * (Q-1) + X; if (flag1 > V){ return "not exist pattern";//not exist }else if(flag1 <0){ return "Zero"; } ll flag2 = Fi * R - F0 * Q; if (flag2 > 0){ return "Overflow"; }else if(flag2 == 0){ return "Safe"; }else if(flag2 < 0){ return "Zero"; } return "not exist pattern"; } int main(){ int T; cin >> T; vector ANS; for (int i = 0;i < T;i++){ ANS.push_back(solve()); } for (auto ans:ANS){ cout << ans << endl; } return 0; }