Kevin is playing Ludo. Whenever he throws the dice he gets a number on the front face of the dice but he is interested in knowing the number written on the opposite side of the dice.
You have to help Kevin in finding the number written on the opposite side of the dice.
Note:Dice is fair. Formerly dice has 6 faces and each face has a number in the range of 1 to 6.
The first line contains a single integer ‘T’ representing the number of test cases.
The first line of each test case will contain a single integer ‘N’ which denotes the number written on the front face of the dice.
Output Format:
For each test case, print the number written on the opposite side of the dice.
Output for every test case will be printed in a separate line.
Note:
You don’t need to print anything; It has already been taken care of.
1 <= T <= 10^7
1 <= N <= 6
Where ‘T’ is the number of test cases.
Where 'N' is the number written on the front face of the dice.
Time limit: 1 sec
1
5
2
In the first test case, the number 2 is written on the opposite side of the dice.
2
6
1
1
6
In the first test case, the number 1 is written on the opposite side of the dice.
In the second test case, the number 6 is written on the opposite side of the dice.
Can you think of the solution by analysing the sum of numbers on the opposite faces of a dice?
The basic idea is to analyze the sum of numbers written on the opposite faces of a dice i.e 7. Now, we have to just return the number that we get after subtracting ‘N’ from 7.
The steps are as follows:
O(1).
We are using a simple arithmetic operation, the overall time complexity is O(1).
O(1).
We are not using any extra space, the overall space complexity is O(1).