remainingInput = int(raw_input());
while remainingInput > 0:
	cardCount = int(raw_input());
	if cardCount == 0:
		print 0
	elif cardCount < 3:
		print 1
	elif cardCount % 3 == 0:
		print cardCount / 3
	else:
		print cardCount
	remainingInput = remainingInput - 1