Connecting the wires

Place each equal-number pair above or below a row so same-side joining arcs never cross, and print the lexicographically smallest side string.

Hard8GraphDFSStackGreedyNo attempts yetTime limit1sMemory limit64 MB

Problem

Seokhwan sells a product called "Lightballb". One Lightballb set holds two balls that carry the same natural number. Most of the time they are ordinary balls, but when two balls with the same number are joined by a wire, they work as a light bulb.

  1. Two balls with the same number are joined by a wire, so the bulb lights up.
  2. Only one ball has a wire plugged in, so the bulb does not light up.
  3. No wire is plugged in, so the bulb does not light up.
  4. Two balls with different numbers are joined by a wire, so the bulb does not light up.

Seunghyun heard that the product was not selling at all and bought nn Lightballb sets to help Seokhwan. He owns 2n2n balls, and for every natural number kk with 1kn1 \le k \le n exactly two balls carry the number kk.

While looking for a place to store that many balls, Seunghyun found the long narrow box below and dropped the balls into it in arbitrary order.

The next day Seunghyun tried to pull the balls back out and they would not move at all. He wanted to watch the balls glow, and he had almost given up when he found out that a wire can pierce the box. Seunghyun now wants to plug the wires in so that every ball glows.

Plugging wires in carelessly risks breaking them, so Seunghyun plans the wiring first. He decided to lay both the box and the wires flat on the floor so that nothing shifts. That alone did not protect against the danger, so Seunghyun set two rules.

  1. Wires must not cross each other, because a crossing can cause a short circuit.
  2. Every part of one wire is above the box, or every part of it is below the box.

The three pictures above all show the box seen from above.

  • (A) satisfies both rules.
  • (B) breaks rule 1, because the wire joining the two balls numbered 2 crosses the wire joining the two balls numbered 3.
  • (C) breaks rule 2, because the wire joining the two balls numbered 4 runs partly above the box and partly below it.

The numbers on the balls in Seunghyun's box are given from left to right. Decide whether the wires can be plugged in under both rules so that every ball glows, and if they can, decide for each ball whether its wire goes above the box or below it.

Input

The first line contains a natural number nn.

The second line contains a1,a2,,a2na_1, a_2, \dots, a_{2n} separated by spaces. Here aia_i is the number written on the ii-th ball from the left in Seunghyun's box.

  • 1n3000001 \le n \le 300000
  • 1ain1 \le a_i \le n for every ii (1i2n1 \le i \le 2n)
  • Every kk (1kn1 \le k \le n) appears exactly twice in the sequence aa.

Output

If no wiring satisfies both rules and lights every ball, print IMPOSSIBLE (without the quotes) on the first line.

Otherwise print a string of length 2n2n on the first line. Its ii-th character (1i2n1 \le i \le 2n) is ^ if the wire plugged into the ii-th ball from the left must run above the box, and v if that wire must run below the box.

If several strings satisfy both rules, print only the lexicographically smallest one. Characters compare by ASCII code, so ^ (0x5E) comes before v (0x76).