t=input()
'''
def fun():
	num=input()
	if num>0 and num<4:
		return str(1)
	elif num%3==0:
		return str(num/3)
	else:
		return str(num)

print '\n'.join([fun() for i in xrange(t)])
'''
j=[input() for i in xrange(t)]
print '\n'.join([str(1) if n>0 and n<4 else str(n/3) if n%3==0  else str(n) for n in j])