def card_list(test_case_count):
    number_of_card_list = []
    while test_case_count >= 1:
        no_of_cards = int(input())
        number_of_card_list.append(no_of_cards)
        test_case_count = test_case_count - 1
    return number_of_card_list



def minimal_attempts(total_card_list):
    toc=total_card_list
    for i in range(len(toc)):
        if toc[i] == 0:
            print(0)
        elif toc[i] < 3:
            print(1)
        elif toc[i] % 3 == 0:
            print(int(toc[i]/3))
        else:
            print(toc[i])


test_case_count = int(input())
total_card_list = card_list(test_case_count)
minimal_attempts(total_card_list)