'use strict'

function main(input) {
  const parsed = parseInput(input);
  printPossibility(canReachGoal(parsed.ships, parsed.goal));
}

function parseInput(input) {
  const inputLines = input.split('\n');
  const goal = inputLines.shift().split(' ')[0];
  const ships = inputLines.map(line => line.split(' '));
  return {goal, ships};
}
  
function canReachGoal(ships, goal) {
  const reachableIslandMap = {};
  const oneStepIslands = [];
  ships.forEach(ship => {
    if (ship[0] === '1') {
      oneStepIslands.push(ship[1]);
    }
    if (ship[1] === goal) {
      reachableIslandMap[ship[0]] = true;
    }
  });
  return oneStepIslands.some(island => reachableIslandMap[island]);
}

function printPossibility(isPossible) {
  console.log(isPossible ? 'POSSIBLE' : 'IMPOSSIBLE');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));