#K3221. Palindromic Bib Assignment

    ID: 24911 Type: Default 1000ms 256MiB

Palindromic Bib Assignment

Palindromic Bib Assignment

Given a range ([A, B]) and an integer (K), determine whether it is possible to select (K) distinct palindromic numbers within the range as bib numbers. A number is palindromic if it reads the same forwards and backwards. More formally, a number (n) is palindromic if (n = \text{reverse}(n)). You are required to check if the count of palindromic numbers in the inclusive interval ([A, B]) is at least (K). If yes, print "POSSIBLE"; otherwise, print "IMPOSSIBLE".

inputFormat

The input is read from standard input (stdin). The first line contains an integer (T) denoting the number of test cases. Each of the following (T) lines contains three space-separated integers: (A), (B), and (K), representing the lower bound, upper bound of the range, and the required count of palindromic numbers respectively.

outputFormat

For each test case, output a single line to standard output (stdout) containing "POSSIBLE" if there are at least (K) palindromic numbers in the range ([A, B]), or "IMPOSSIBLE" otherwise.## sample

3
1 100 5
100 200 10
300 400 15
POSSIBLE

POSSIBLE IMPOSSIBLE

</p>