문제2621--Nice Licence Plates

### 2621: Nice Licence Plates

실행시간 제한: 1 Sec  메모리사용 제한: 128 MB
제출: 8  통과: 4
[제출] [채점기록] [묻고답하기]

#### 문제 설명

Alberta licence plates currently have a format of ABC-0123 (three letters followed by four digits). We say that the licence plate is "nice" if the absolute difference between the value of the first part and the value of the second part is at most $100$.

The value of the first part is calculated as the value of base-26 number (where digits are in [A..Z]). For instance, if the first part is "ABC", its value is $28 = (0*26^2 + 1*26^1 + 2*26^0)$. So, the plate "ABC-0123" is nice, because $|28-123|<=100$.

Given the list of licence plate numbers, your program should determine if the plate is nice or not.

#### 입력 설명

First line of the input contains an integer $N (1 \leq N \leq 100)$, the number of licence plate numbers. Then follow $N$ lines, each containing a licence plate in the format LLL-DDDD.

#### 출력 설명

For each licence plate print on a line "nice" or "not nice" (without quotes) depending on the plate number being nice as described in the probem statement.

#### 입력 예시 Copy

2
ABC-0123
AAA-9999


#### 출력 예시 Copy

nice
not nice