T = int(input()) for _ in range(T): V, X, Fo, Fi, Q, R = map(int, input().split()) t = 0 while t <= 10**100: if t % Q < R: dt = min((V - X)/Fi, R - t % Q, X/Fo) else: dt = min((V - X)/Fi, Q - t % Q, X/Fo) X += (Fi - Fo) * dt t += dt if X > V: print("Overflow") break elif X <= 0: print("Zero") break else: print("Safe")