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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

N = long(raw_input())

for i in xrange(N):
	I = long(raw_input())
	if I == 0:
		print 0
	elif I < 3:
		print 1
	elif I%3 == 0:
		print I/3
	else:
		print I