import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) data = np.array(read().split(), np.float64) X = data[::12] Y = data[1::12] answer = (np.arctan2(Y,X) / np.pi * 180) % 60 answer[answer > 50] = 0 print('\n'.join(answer.astype(str)))