Cleaning the Room

No attempts yetTime limit1sMemory limit256 MB

Problem

Eungi has NN bottles, numbered 1 through NN, and LL drawers, numbered 1 through LL. The bottles are scattered across his bedroom floor, and he has decided to clean the room.

A drawer holds at most one bottle. So that he can find the bottle he wants quickly later, Eungi wrote down two drawer numbers AiA_i and BiB_i for every bottle. Those two are the only drawers bottle ii fits into.

Eungi puts the bottles away in order from bottle 1 to bottle NN, applying the following rules to each bottle from top to bottom.

  1. If drawer AiA_i is empty, put bottle ii into it.
  2. If drawer BiB_i is empty, put bottle ii into it.
  3. Move the bottle sitting in drawer AiA_i into the other drawer that bottle fits into. If that drawer already holds a bottle, move that bottle into its other drawer, and continue the same way. If the chain of moves reaches an empty drawer, carry out every move and put bottle ii into drawer AiA_i. If it never reaches an empty drawer, go on to the next rule.
  4. Try the same procedure starting from drawer BiB_i. On success, put bottle ii into drawer BiB_i. On failure, go on to the next rule.
  5. If rules 1 through 4 all fail, Eungi drinks bottle ii on the spot. (He never gets drunk at all.)

Write a program that determines, for each bottle, whether it is stored in a drawer or drunk on the spot.

Input

The first line contains NN and LL. (1N,L3000001 \le N, L \le 300\,000)

Each of the next NN lines contains AiA_i and BiB_i. (1Ai,BiL1 \le A_i, B_i \le L, AiBiA_i \ne B_i)

Output

For bottle 1 through bottle NN, in order, print one line each: LADICA if the bottle is stored in a drawer, SMECE if it is drunk on the spot.

Hint

In the example, the first six bottles go into drawers 1, 3, 5, 7, 9, and 2 by rule 1.

The seventh bottle uses rule 3. The bottle in drawer 1 moves to drawer 2, the bottle in drawer 2 moves to drawer 3, and the bottle in drawer 3 moves to drawer 4.

The eighth bottle goes into drawer 8.

The ninth bottle uses rule 3 as well. The bottle in drawer 7 moves to drawer 8, the one in drawer 8 moves to drawer 2, the one in drawer 2 moves to drawer 1, the one in drawer 1 moves to drawer 5, and the one in drawer 5 moves to drawer 6.