Hero

No attempts yetTime limit1sMemory limit256 MB

Problem

Bitor must defeat n monsters in some order with starting health z. Monster i deals d_i damage and then restores a_i health if defeated. Health must stay positive throughout. Decide if all monsters can be defeated and output one winning order.

Input

The first line has n and z. The next n lines give d_i and a_i.

Output

Print NIE if impossible. Otherwise print TAK on the first line and a permutation on the second line.

Constraints

  • 1n,z100,0001 \leq n, z \leq 100{,}000