# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Hello Choto Bondhu!

By Shahwat_Has9 · Limits 1s, 512 MB

Hello Choto Bondhu,

Let’s play a game. I will give you a number n. You will have to tell me n2. Okay, it may seem difficult for you to calculate this huge number. So tell me the last digit of n2. In other words: (n2 % 10).

## Input

The first line will contain T, which indicates test cases.

Here, 1 ≤ T ≤ 100.

Next T line will contain a number n.

Constraints:

Subtask 1, for 20 points, 1 ≤ n ≤ 109.

Subtask 2, for 25 points, 1 ≤ n ≤ 10100.

Subtask 3, for 55 points, 1 ≤ n ≤ 10100000

## Output

Print T lines.

For each cases, print n2 % 10

## Sample

InputOutput
```6
1
2
3
4
5
6
```
```1
4
9
6
5
6
```

When n = 1, ans = (n * n) % 10 = 1 % 10 = 1.

When n = 2, ans = (n * n) % 10 = 4 % 10 = 4.

When n = 3, ans = (n * n) % 10 = 9 % 10 = 9

When n = 4, ans = (n * n) % 10 = 16 % 10 = 6.

When n = 5, ans = (n * n) % 10 = 25 % 10 = 5.

When n = 6, ans = (n * n) % 10 = 36 % 10 = 6.

### Statistics

69% Solution Ratio

DraakKrijgerFCEarliest, 1M ago

borisalFastest, 0.0s 