'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
T = int(raw_input())
P = []
for i in range(T):
	temp = int(raw_input())
	P.append(temp)
	
for i in range(T):
	res = 0
	if P[i] == 0:
		res = 0
	elif P[i] == 1 or P[i] == 2:
		res = 1
	elif P[i] % 3 == 0:
		res = P[i]/3
	else:
		res = P[i]
	print(str(res))