T=int(input()) assert 1<=T<=20 for _ in range(T): N,K,H,Y=map(int,input().split()) assert 1<=N<=pow(10,6) assert 1<=K<=pow(10,6) assert 1<=H<=pow(10,6) assert 1<=Y<=pow(10,12) A=max(N,K,H) assert Y//A<=pow(10,6) print("OK")