This page is still under construction.

Parts of this page are still being built. What you see may change.

Alice Through the Looking Glass

Interview

Time limit2sMemory limit512 MB

Summary
Given a magnification level and a cell coordinate, decide whether that cell of the 5^m by 5^m self-similar grid is filled or empty.
Level

Medium5 of 10

Topics
Recursion, Divide and conquer, Implementation
Solved
No attempts yet

Problem

Alice is looking at a crystal through a microscope. Her microscope has an interesting feature: it can superimpose grid lines over the image she is looking at.

At magnification level 1, Alice sees the image below, with a 5×55 \times 5 grid superimposed over it.

Magnification level 1

As Alice increases the magnification, the leaf-like pattern becomes more intricate. At magnification level 2 she sees the image with a 25×2525 \times 25 grid, and the crystal repeats its own shape at a smaller scale, stacked on top of itself.

Magnification level 2

This self-similarity repeats at every magnification level. In general, at magnification level mm the microscope shows a 5m×5m5^m \times 5^m grid.

Alice's microscope supports up to 13 levels of magnification, and she would like to determine, for any grid cell, whether it is filled with crystal.

The grid cells are labeled so that the bottom-left cell is (0,0)(0, 0), the bottom-right cell is (5m−1,0)(5^m - 1, 0), the top-left cell is (0,5m−1)(0, 5^m - 1), and the top-right cell is (5m−1,5m−1)(5^m - 1, 5^m - 1).

Given a magnification level mm (1≤m≤131 \le m \le 13) and a grid position (x,y)(x, y) with 0≤x<5m0 \le x < 5^m and 0≤y<5m0 \le y < 5^m, determine whether that grid cell is filled with crystal or is empty space.

Input

The first line contains an integer TT (1≤T≤101 \le T \le 10), the number of queries. Each of the next TT lines contains three integers mm, xx, and yy: the magnification level and the position of the grid cell Alice wishes to examine.

Output

Print TT lines. For each query, print crystal if the specified grid cell contains crystal, or empty if it is empty space.

Examples1

  1. Example 1

    Input
    4
    1 1 1
    1 1 0
    1 2 1
    2 8 5
    
    Expected output
    empty
    crystal
    crystal
    crystal