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

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

t = int(input())

for i in range(t):
	n=int(input())
	if n==0:
		ans=0
	elif n<=3:
		ans=1
	elif n%3!=0:
		ans=n
	else:
		ans=n/3
	print ans