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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
T = int(raw_input())
for x in xrange(T) :
	N = int(raw_input())
	if 1<=N<=3 : N = 1
	if N%3==0 : N = N/3
	print N