

Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 点
問題文
高橋キングダムには、高橋諸島という、 個の島からなる諸島があります。 便宜上、これらの島を島 、島 、 ...、島 と呼ぶことにします。
これらの諸島の間では、船の定期便が 種類運行されています。 定期便はそれぞれ つの島の間を行き来しており、 種類目の定期便を使うと、 島 と島 の間を行き来する事ができます。
すぬけくんは今島 にいて、島 に行きたいと思っています。 しかし、島 から島 への定期便は存在しないことがわかりました。 なので、定期便を つ使うことで、島 に行けるか調べたいと思っています。
これを代わりに調べてあげてください。
制約
- ならば
入力
入力は以下の形式で標準入力から与えられる。
:
出力
定期便を つ使いたどり着けるならば POSSIBLE
、たどり着けないならば IMPOSSIBLE
と出力する。
入力例 1Copy
3 2 1 2 2 3
出力例 1Copy
POSSIBLE
入力例 2Copy
4 3 1 2 2 3 3 4
出力例 2Copy
IMPOSSIBLE
島 へ行くには、定期便を つ使う必要があります。
入力例 3Copy
100000 1 1 99999
出力例 3Copy
IMPOSSIBLE
入力例 4Copy
5 5 1 3 4 5 2 3 2 4 1 4
出力例 4Copy
POSSIBLE
島 、島 、島 と移動すれば つの定期便で移動可能です。
Score : points
Problem Statement
In Takahashi Kingdom, there is an archipelago of islands, called Takahashi Islands. For convenience, we will call them Island , Island , ..., Island .
There are kinds of regular boat services between these islands. Each service connects two islands. The -th service connects Island and Island .
Cat Snuke is on Island now, and wants to go to Island . However, it turned out that there is no boat service from Island to Island , so he wants to know whether it is possible to go to Island by using two boat services.
Help him.
Constraints
- If , .
Input
Input is given from Standard Input in the following format:
:
Output
If it is possible to go to Island by using two boat services, print POSSIBLE
; otherwise, print IMPOSSIBLE
.
Sample Input 1Copy
3 2 1 2 2 3
Sample Output 1Copy
POSSIBLE
Sample Input 2Copy
4 3 1 2 2 3 3 4
Sample Output 2Copy
IMPOSSIBLE
You have to use three boat services to get to Island .
Sample Input 3Copy
100000 1 1 99999
Sample Output 3Copy
IMPOSSIBLE
Sample Input 4Copy
5 5 1 3 4 5 2 3 2 4 1 4
Sample Output 4Copy
POSSIBLE
You can get to Island by using two boat services: Island -> Island -> Island .