Absurd Prices

Interview

Time limit1sMemory limit128 MB

Summary
Given a price in cents, decide whether some integer within 5 percent (rounded to a closed interval) has strictly smaller digit-based absurdity, where absurdity is twice the digit count minus one if the last nonzero digit is 5.
Level

Medium6 of 10

Topics
Math, Brute force, Implementation, Number theory
Solved
No attempts yet

Problem

You have surely noticed that supermarkets, shopping centres, and vendors of all kinds seem to be in love with the digit 9: it appears in product prices more often than any other digit, preferably in the least significant positions. Your favourite chocolate bar might cost 99 cents — just low enough to advertise that it costs less than 1 euro. Your new bicycle might cost 499.98 euros, which is, of course, less than 500 euros.

While such comparisons are mathematically sound, they seem to take the customer for a fool. And who wants to lug home all those annoying small coins handed back as change?

Fortunately, FIFA has not adopted this strange pricing scheme: a ticket for the final costs 900 dollars in the first category, 600 dollars in the second, and 400 dollars in the third. These prices may be considered strange only for other reasons.

We want to tell absurd prices such as 99 cents or 499.98 euros apart from normal ones. To measure the absurdity of a positive integer, do the following:

  • Remove all trailing zeros — the zeros in the least significant positions. You are left with a positive integer, call it xx, whose last digit dd is non-zero.
  • Let aa be the number of digits of xx.
  • If d=5d = 5, the absurdity of the number is 2a−12a - 1.
  • Otherwise, the absurdity of the number is 2a2a.

For example, the absurdity of 350350 is 33, and the absurdity of 900900900900 is 88. Using this measure, we define an absurd price: a price cc is absurd if and only if the closed interval [0.95c, 1.05c][0.95c,\ 1.05c] contains an integer ee whose absurdity is smaller than the absurdity of cc.

Given a price in cents, decide whether it is absurd!

Input

The first line contains the number tt of test cases. Each of the following test cases is given on one line containing a single integer cc. You may assume that 1≤c≤1091 \le c \le 10^9.

Output

For each test case, print absurd if the price cc is absurd and not absurd otherwise, one result per line, following the format shown in the examples.

Examples3

  1. Example 1

    Input
    4
    99
    49998
    90000
    970000000
    
    Expected output
    absurd
    absurd
    not absurd
    absurd
    
  2. Example 2

    Input
    1
    1
    
    Expected output
    not absurd
    
  3. Example 3

    Input
    1
    5
    
    Expected output
    not absurd