jiahuimbzuai/CoQuIR huggingface dataset:
//  [swift]
let input = readLine()!.split(separator: " ").map{ Int($0)! }
let A = input[0]
let B = input[1]

func getStrength(_ value: Int) -> Int {
    if value == 1 {
        return 13
    } else {
        return value - 1
    }
}

let strengthA = getStrength(A)
let strengthB = getStrength(B)

if strengthA == strengthB {
    print("Draw")
} else {
    print(strengthA > strengthB ? "Alice" : "Bob")
}
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!}.map{i i>1 ?i:i+2};print(i[0]-i[1]>0 ?"Alice":(i[0]-i[1]<0 ?"Bob":"Draw"))
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const A = parseInt(input[0], 10);
  const B = parseInt(input[1], 10);
  
  if(A == 1) A = 14;
  if(B == 1) B = 14;
  
  if (A>B) {
    console.log("Alice");
  }else if(A<B) {
    console.log("Bob");
  }else{
    console.log("Draw");
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let[a,b]=nrin(2)
  if(a==1)a=14
  if(b==1)b=14
  out(a==b?'Draw':a>b?'Alice':'Bob')
}
main()
//  [typescript]
var input: string = require('fs').readFileSync('/dev/stdin', 'utf8');
var inputLines: string[] = input.trim().split("\n");
var parts = inputLines[0].split(" ");

var A = parseInt(parts[0]);
var B = parseInt(parts[1]);

var ans = A >= B ? "Alice" : "Bob";
if (A == B) {
    ans = "Draw";
} else if (A == 1) {
    ans = "Alice";
} else if (B == 1) {
    ans = "Bob";
}

console.log(ans);
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const A = parseInt(input[0], 10);
  const B = parseInt(input[1], 10);
  
  if (A>B) {
    console.log("Alice");
  }else if(A<B) {
    console.log("Bob");
  }else{
    console.log("Draw");
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
import * as fs from "fs"

function Main(input: string) {

  const [y, ...x] = input.split("\n")

  const [n, m] = y.split(" ").map(str => parseInt(str, 10))

  const a = x.slice(0, n)
  const b = x.slice(n, n + m)


  let flag = false

  for (let i = 0; i < n - m + 1; i++) {
    const start = a[i].indexOf(b[0])
    if (start > -1) {
      // console.log(start)
      if (m === 1) flag = true
      for (let j = i + 1; j < n; j++) {
        if (a[j].indexOf(b[j - i], start) == 0) {
          if (j - i === m - 1) {
            flag = true
          }
        }
      }
    }
  }

  if (flag) console.log("Yes")
  else console.log("No")

}


fs.readFile('/dev/stdin', (err, data) => {
  if (err) {
    Main(fs.readFileSync('./input.txt', 'utf8'))
    return null
  }
  Main(data.toString())
  return null
})
//  [typescript]
var input: string = require('fs').readFileSync('/dev/stdin', 'utf8');
var inputLines: string[] = input.trim().split("\n");
var parts = inputLines[0].split(" ");

var A = parseInt(parts[0]);
var B = parseInt(parts[1]);

var ans = A >= B ? "Alice" : "Bob";
if (A == B) {
    ans = "Draw";
} else if (B == 1) {
    ans = "Bob";
}

console.log(ans);
//  [python]
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, m = inintm()

t = [0]*(n+1)

for _ in range(m):
    a, b = inintm()
    if a == 1:
        if t[b] == 1:
            print("POSSIBLE")
            exit()
        t[b] = 1
    elif b == n:
        if t[a] == 1:
            print("POSSIBLE")
            exit()
        t[a] = 1

print("IMPOSSIBLE")
//  [python]
# ABC068C - Cat Snuke and a Voyage (ARC079C)
def main():
    N, M, *AB = map(int, open(0).read().split())
    sources, targets = set(), set()
    for a, b in zip(*[iter(AB)] * 2):
        if a == 1:
            sources.add(b)
        if b == N:
            targets.add(a)
    flg = sources & targets  # intermediate point of both 1, N exists?
    print("POSSIBLE" if flg else "IMPOSSIBLE")


if __name__ == "__main__":
    main()
//  [python]
def main():
  N, M, *AB = map(int, open(0).read().split())

  inter, goalable = set(), set()
  
  iterator = iter(AB)
  for a, b in zip(iterator, iterator):
    if a == 1:
      inter.add(b)
    
    if b == N: 
      goalable.add(a)
      
  flag = inter & goalable
  print("POSSIBLE" if flag else "IMPOSSIBLE")
  
if __name__ == "__main__":
    main()
//  [python]
from collections import deque

n,m = map(int, input().split())
G = [[] for _ in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

dist = [-1]*n
que = deque()
dist[0]=0
que.append(0)
while len(que):
    v = que.pop()
    for node in G[v]:
        if dist[node]==-1:
            dist[node]=dist[v]+1
            que.append(node)

if dist[-1]==2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
//  [python]
from collections import deque

n,m = map(int, input().split())
G = [[] for _ in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

dist = [-1]*n
que = deque()
dist[0]=0
que.append(0)
while len(que):
    v = que.pop()
    for node in G[v]:
        if dist[node]==-1:
            dist[node]=dist[v]+1
            que.append(node)

if dist[-1]==1 or dist[-1]==2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
//  [python]
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 27 02:05:32 2020

@author: liang
"""

N, M = map(int, input().split())
first = list()
second = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        first.append(b)
    if b == N:
        second.add(a)
        
for a in first:
    if a in second:
        print("POSSIBLE")
        break
else:
    print("INPOSSIBLE")
//  [java]
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		int n = in.readInt();
		int m = in.readInt(); 
		boolean sol[] = new boolean[n+1];
		boolean ans = false; 
		for(int i = 0; i<m; i++) {
			int a = in.readInt();
			int b = in.readInt(); 
			if(a==1) {
				if(sol[b]) {
					ans = true; 
				}
				sol[b] = true; 
			}
			else if(b == n) {
				if(sol[a]) {
					ans = true;
				}
				sol[a] = true; 
			}
		}
		System.out.println(ans?"POSSIBLE":"IMPOSSIBLE"); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
//  [java]
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.InputStream;

import java.io.PrintWriter;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);

        final int N = nextInt();
        final int M = nextInt();

        boolean[] S = new boolean[N];
        boolean[] E = new boolean[N];

        for (int i = 0; i < M; i++) {
            int f = nextInt();
            int s = nextInt();

            if (f == 1) S[s] = true;
            else if (s == N) E[f] = true;
        }

        String ans = "IMPOSSIBLE";

        for (int i = 0; i < N; i++) {
            if (S[i] && E[i]) {
                ans = "POSSIBLE";
                break;
            }
        }

        out.println(ans);

        out.flush();
    }

    // FastScanner start
    static final InputStream in = System.in;
    static final byte[] buffer = new byte[1024];
    static int ptr = 0;
    static int buflen = 0;
    static boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    static int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    static boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    static String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    static long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    static int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    static double nextDouble() {
        return Double.parseDouble(next());
    }
    // FastScanner end
}
//  [java]
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] a = new int[M];
    int[] b = new int[M]; 
    List<Integer> list = new ArrayList<>();
    for(int i=0;i<M;i++){
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
      if(a[i]==1){
        list.add(i);
      }
    }
    String ans = "IMPOSSIBLE";
    for(int i=0;i<list.size();i++){
      for(int j=0;j<M;j++){
        if(a[j]==b[list.get(i)] && b[j]==N){
          ans = "POSSIBLE";
          break;
        }
      }
    }
    System.out.println(ans);
  }
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int m = scn.nextInt();
		int[] a = new int[m];
      	int[] b = new int[m];
		for(int i=0; i<m; i++){
			a[i] = scn.nextInt();
          	b[i] = scn.nextInt();
		}
      	ArrayList<Integer> list = new ArrayList<>();
      	for(int i=0; i<m; i++){
			if(a[i]==1) list.add(b[i]);
          	if(b[i]==n) list.add(a[i]);
		}
      	Collections.sort(list);
      	String ans = "IMPOSSIBLE";
      	for(int i=0; i<list.size()-1; i++){
          if(list.get(i) == list.get(i+1)){
            ans = "POSSIBLE";
            break;
          }
        }
      	System.out.println(ans);
	}
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int m = scn.nextInt();
		int[] a = new int[m];
      	int[] b = new int[m];
		for(int i=0; i<m; i++){
			a[i] = scn.nextInt();
          	b[i] = scn.nextInt();
		}
      	ArrayList<Integer> list = new ArrayList<>();
      	for(int i=0; i<m; i++){
			if(a[i]==1) list.add(b[i]);
          	if(b[i]==n) list.add(a[i]);
		}
      	Collections.sort(list);
      	String ans = "IMPOSSIBLE";
      	for(int i=0; i<list.size(); i++){
          if(list.get(i) == list.get(i+1)){
            ans = "POSSIBLE";
            break;
          }
        }
      	System.out.println(ans);
	}
}
//  [cpp]
#include <cstdio>
bool A[200001];
inline char tc(void){
  static char fl[10000],*A=fl,*B=fl;
  return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++;  
}
inline int read(void){
  int a=0;static char c;
  while((c=tc())<'0'||c>'9');
  while(c>='0'&&c<='9')a=a*10+c-'0',c=tc();
  return a;
}
int main(){
  int n,m,a,b;n=read();m=read();
  while(m--){a=read();b=read();
    if(a==1){
      if(A[b]==true)return puts("POSSIBLE"),0;
      A[b]=true;
    }
    if(b==n){
      if(A[a]==true)return puts("POSSIBLE"),0;
      A[a]=true;
    }
  }
  puts("IMPOSSIBLE");
  return 0;
}
//  [cpp]
#include <cstdio>
bool A[200001];
inline char tc(){
  static char fl[100],*A=fl,*B=fl;
  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  
}
inline int read(){
  int a=0;static char c;
  while((c=tc())<48||c>57);
  while(c>=48&&c<=57)a=a*10+c-48,c=tc();
  return a;
}
int main(){
  int n,m,a,b;n=read();m=read();
  while(m--){a=read();b=read();
    if(a==1){
      if(A[b])return puts("POSSIBLE"),0;
      A[b]=1;
    }
    if(b==n){
      if(A[a])return puts("POSSIBLE"),0;
      A[a]=1;
    }
  }
  puts("IMPOSSIBLE");
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n,m;
  cin >> n >> m;
  vector<vector<ll>> G(n);
  rep(i,m){
    ll a,b;
    cin >> a >> b;
    a--;
    b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  queue<ll> que;
  que.push(0);
  vector<ll> dist(n,-1);
  dist.at(0)=0;
  while(!que.empty()){
    ll v=que.front();
    que.pop();
    for(ll p: G[v]){
      if(dist.at(p)!=-1){
        continue;
      }
      dist.at(p)=dist.at(v)+1;
      que.push(p);
    }
  }
  string ans="IMPOSSIBLE";
  if(dist.at(n-1)<=2){
    ans="POSSIBLE";
  }
  cout << ans;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n + 1); i++)
// vector<vector<int>> A(3, vector<int>(4));
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    int N, M;
    cin >> N >> M;

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int  x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1); // xの木とyの木を併合する
    }

    int cnt=0;
    for(int i=0;i<N;i++){
        if(!tree.same(0,i)){
            tree.unite(0, i);
            cnt++;
        }
    }
    if(cnt<=1){
        cout<<"POSSIBLE"<<endl;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
    }
}
//  [c]
m[1<<18];*p;main(n,a,b){for(scanf("%d%*d",&n);~scanf("%d%d",&a,&b);p-m&&*p?n=0:++*p)p=m+(a-1?b-n?0:a:b);puts(n?"IMPOSSIBLE":"POSSIBLE");}
//  [c]
#include <stdio.h>
long flag[200000];

int main(void){
  long N,M;
  long a,b;
  scanf("%ld%ld",&N,&M);



  for(int i = 0;i < M;i++) flag[i] = 0;
  for(int i = 0;i < M;i++){
    scanf("%ld%ld",&a,&b);
    if(a == 1) flag[b-1]++;
    if(b == N) flag[a-1]++;
  }

  for(int i = 0;i < M;i++){
    if(flag[i] == 2){
      printf("POSSIBLE\n");
      return 0;
    }
  }
  printf("IMPOSSIBLE\n");

  return 0;
}
//  [c]
#include <stdio.h>

int aaa[200000] = {};

int main()
{
	long n, m;
	long x, y;
	int ans = 0;
	scanf("%ld %ld", &n, &m);
	for (long i = 0; i < m; i++)
	{
		scanf("%ld %ld", &x,&y);
		if (x == 1)
		{
			aaa[y]++;
		}
		if (y == n)
		{
			aaa[x]++;
		}
	}
	for (long i = 0; i < 200000; i++)
	{
		if (aaa[i] >= 2)
		{
			ans = 1;
			break;
		}
	}
	if (ans == 1)
	{
		printf("POSSIBLE");
	}
	else
	{
		printf("IMPOSSIBLE");
	}
	return 0;
}
//  [c]
#include<stdio.h>
int main()
{
    int i,j,k,c=0,n,t,fixed,half,m;
    scanf("%d %d",&m,&n);
    int array1[n],array2[n];
    for(i=0;i<n;i++){
        scanf("%d %d",&array1[i],&array2[i]);
    }
    fixed=m;
    for(i=0;i<n;i++){
        if(array1[i]==1){
            half=array2[i];
            for(j=0;j<n;j++){
                if((array1[j]==half)&&(array2[j]==fixed)){
                    c=1;
                    break;
                }
            }
        }
        if(c==1)
            break;
    }
    if(c==1)
        printf("POSSIBLE\n");
    else
        printf("IMPOSSIBLE\n");
    return 0;
}
//  [c]
#include<stdio.h>
int main()
{
int n,m,i;
  scanf("%d %d",&n,&m);
  int a[m],b[m],sw1[n+1],sw2[n+1],cc;
  
  for(i=0;i<n+1;++i)
  {
  sw1=0;
  sw2=0;
  }
  
  cc=0;
  
  for(i=0;i<m;++i)
  {
  scanf("%d %d",&a[i],&b[i]);
  if(a[i]==1) sw1[b[i]]++;
  if(b[i]==n) sw2[a[i]]++;
  }

  for(i=1;i<n+1;++i)
  {
  if(sw1[i]>0 && sw2[i]>0) cc++;
  }
  if(cc >0) printf("POSSIBLE");
  else printf("IMPOSSIBLE");

return 0;}
//  [c]
#include <stdio.h>
#include <string.h>

int main (void)
{
    int n,m,i,j,key=0,k=0,l=0;
    int a[200000],b[200000],maec[200000],atoc[200000];
    scanf("%d %d",&n,&m);
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==1)
        {
            maec[k]=b[i];
            k++;
        }else{
            if(b[i]==n)
            {
                atoc[l]=a[i];
                l++;
            }
        }
    }
    for(i=0;i<k;i++)
    {
        for(j=0;j<l;j++)
        {
            if(maec[i]==atoc[j])
            {
                key++;
                break;
            }
        }
        if(key==1)
        {
            break;
        }
    }
    if(key==1)
        puts("POSSIBLE");
    else
        puts("IMPOSSIBLE");
    return 0;
}
//  [javascript]
function main(input){
    var tmp;
    input = input.split("\n");
    tmp = input[0].split(" ");
    var N = Number(tmp[0]);
    var M = Number(tmp[1]);
    var p1 = new Array(input.length);
    var p2 = new Array(input.length);
    p1.fill(false);
    p2.fill(false);

    for(var i=0; i<input.length; i++){
        tmp = input[i].split(" ");
        if(Number(tmp[0])==1){
            p1[Number(tmp[1])] = true;
        }
        if(Number(tmp[1])==N){
            p2[Number(tmp[0])] = true;
        }
    }

    var index = -1;
    while(true){
        var index = p1.indexOf(true, index+1);
        if(index<0){
            console.log("IMPOSSIBLE");
            return;
        }else{
            if(p2[index]){
                console.log("POSSIBLE");
                return;
            }
        }
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0]);
  var m = parseInt(input[0].split(" ")[1]);
  x= new Array(Math.pow(10,5)*2).fill(0);
  var ans = "IMPOSSIBLE";
  for(i=0;i<m;i++){
    tmp=input[i+1].split(" ");
    if(tmp[0]==1){
      if(x[tmp[1]]==1){
        ans="POSSIBLE";
        break;
      }else{
      x[tmp[1]]++;
      }
    }
    if(tmp[1]==n){
      if(x[tmp[0]]==1){
        ans="POSSIBLE";
        break;
      }else{
        x[tmp[0]]++;
      }
    }
  }


  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'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"));
//  [javascript]
"use strict";
function Main(input) {
  var parseInputData = parseInput(input);
  resultValue(parseInputData);
}
var parseInput = (input) => {
  console.log(input);
  const lines = input.split(" ");
  //Aピザの価格
  const valuePizzaA = parseInt(lines[0], 10);
  //Bピザの価格
  const valuePizzaB = parseInt(lines[1], 10);
  //ABピザの価格
  const valuePizzaAB = parseInt(lines[2], 10);
  //必要なAピザの枚数
  const needQuantityPizzaA = parseInt(lines[3], 10);
  //必要なBピザの枚数
  const needQuantityPizzaB = parseInt(lines[4], 10);
  return { valuePizzaA: valuePizzaA, valuePizzaB: valuePizzaB, valuePizzaAB: valuePizzaAB, needQuantityPizzaA: needQuantityPizzaA, needQuantityPizzaB: needQuantityPizzaB};
}

//ピザの組み合わせの最安価を出力する
var resultValue = (parseInputData) => {
  parseInputData.valuePizzaAB > parseInputData.valuePizzaA + parseInputData.valuePizzaB ?
  console.log(parseInputData.valuePizzaA * parseInputData.needQuantityPizzaA + parseInputData.valuePizzaB * parseInputData.needQuantityPizzaB) : 
  usePizzaABValue(parseInputData)
}

//ピザABを使用する場合の最安価を出力
var usePizzaABValue = (parseInputData) => {
  const needAmountPizzaAB= (parseInputData.needQuantityPizzaA > parseInputData.needQuantityPizzaB ?
    parseInputData.needQuantityPizzaB*2 : parseInputData.needQuantityPizzaA*2);
  console.log(parseInputData.needQuantityPizzaA > parseInputData.needQuantityPizzaB ?
    needAmountPizzaAB * parseInputData.valuePizzaAB + parseInputData.valuePizzaA * (parseInputData.needQuantityPizzaA - parseInputData.needQuantityPizzaB) :
    needAmountPizzaAB * parseInputData.valuePizzaAB + parseInputData.valuePizzaB * (parseInputData.needQuantityPizzaB + parseInputData.needQuantityPizzaA)
  )
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
function Main(input) {
  var parseInputData = parseInput(input);
  const result = isReachCheck(parseInputData.shipVariations, parseInputData.goalIsland);
  isPossibleCheck(result);

}
var parseInput = (input) => {
  input = input.split("\n");
  const lines = input[0].split(" ");
  //島のゴールを格納
  const goalIsland = parseInt(lines[0], 10);
  //船の数を格納
  const shipCount = parseInt(lines[1], 10);
  var shipVariations = parseShipVariations(shipCount, input);
  return { shipVariations: shipVariations, goalIsland: goalIsland };
}

//島に到着するかを確認する関数
var isReachCheck = (shipVariations, goalIsland) => {
  const ship1Variations = shipVariations.filter(function (shipVariation) {
    return shipVariation[0] === 1;
  });
  return (shipVariations.some((ship2Variation) => {
    return (ship1Variations.some((ship1Variation) => {
      if (ship1Variation[1] === ship2Variation[0] && ship2Variation[1] === goalIsland) {
        return true;
      };
    })
    )
  }));
}

//booleanを判別する関数
var isPossibleCheck = (isPossible) => {
  if (isPossible) {
    console.log('POSSIBLE');
  }
  else {
    console.log('IMPOSSIBLE');
  }
}

//船の特徴を配列に格納する関数
var parseShipVariations = (shipCount, lines) => {
  return lines.slice(1, shipCount + 1).map(line => line.split(" ").map(x => parseInt(x)));
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
function Main(input) {
  var parseInputData = parseInput(input);
  const result = isReachCheck(parseInputData.shipVariations, parseInputData.goalIsland);
  isPossibleCheck(result);

}
var parseInput = (input) => {
  input = input.split("\n");
  const lines = input[0].split(" ");
  //島のゴールを格納
  const goalIsland = parseInt(lines[0], 10);
  //船の数を格納
  const shipCount = parseInt(lines[1], 10);
  var shipVariations = parseShipVariations(shipCount, input);
  return { shipVariations: shipVariations, goalIsland: goalIsland };
}

//島に到着するかを確認する関数
var isReachCheck = (shipVariations, goalIsland) => {
  const ship1Variations = shipVariations.filter(function (shipVariation) {
    return shipVariation[0] === 1;
  });
  return (shipVariations.some(function (ship2Variation) {
    return (ship1Variations.some(function (ship1Variation) {
      if (ship1Variation[1] === ship2Variation[0] && ship2Variation[1] === goalIsland) {
        return true;
      };
    })
    )
  }));
}

//booleanを判別する関数
var isPossibleCheck = (isPossible) => {
  if (isPossible) {
    console.log('POSSIBLE');
  }
  else {
    console.log('IMPOSSIBLE');
  }
}

//船の特徴を配列に格納する関数
var parseShipVariations = (shipCount, lines) => {
  return lines.slice(1, shipCount + 1).map(line => line.split(" ").map(x => parseInt(x)));
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, m := scanInt(), scanInt()
	c, d := make([]bool, n), make([]bool, n)
	for i := 0; i < m; i++ {
		a, b := scanInt()-1, scanInt()-1
		if a == 0 {
			c[b] = true
		}
		if b == n-1 {
			d[a] = true
		}
	}

	for i := 0; i < n; i++ {
		if c[i] && d[i] {
			fmt.Fprintln(wr, "POSSIBLE")
			return
		}
	}
	fmt.Fprintln(wr, "IMPOSSIBLE")
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Cat Snuke and a Voyage
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	sc.Split(bufio.ScanWords)
	var a, b int
	c := make([]int, 0)
	d := make([]int, 0)

	for i := 0; i < M; i++ {
		a = nextInt()
		b = nextInt()
		if a == 1 {
			c = append(c, b)
		} else if b == N {
			d = append(d, a)
		}
	}

	sort.Sort(sort.IntSlice(c))
	sort.Sort(sort.IntSlice(d))

	var flag int = 0
	for _, v1 := range c {
		for _, v2 := range d {
			if v1 == v2 {
				flag = 1
				break
			} else if v1 < v2 {
				break
			}
		}
		if flag == 1 {
			break
		}
	}

	if flag == 1 {
		fmt.Println("POSSIBLE")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Cat Snuke and a Voyage
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	sc.Split(bufio.ScanWords)
	var a, b int
	c := make([]int, 0)
	d := make([]int, 0)

	for i := 0; i < M; i++ {
		a = nextInt()
		b = nextInt()
		if a == 1 {
			c = append(c, b)
		} else if b == N {
			d = append(d, a)
		}
	}

	var flag int = 0
	for _, v1 := range c {
		for _, v2 := range d {
			if v1 == v2 {
				flag = 1
				break
			}
		}
		if flag == 1 {
			break
		}
	}

	if flag == 1 {
		fmt.Println("POSSIBLE")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Cat Snuke and a Voyage
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	sc.Split(bufio.ScanWords)
	a := make([]int, M)
	b := make([]int, M)
	c := make([]int, 0)
	d := make([]int, 0)

	for i := 0; i < M; i++ {
		a[i] = nextInt()
		b[i] = nextInt()
		if a[i] == 1 {
			c = append(c, b[i])
		}
		if b[i] == N {
			d = append(d, a[i])
		}
	}

	var flag int = 0
	for _, v1 := range c {
		for _, v2 := range d {
			if v1 == v2 {
				flag = 1
				break
			}
		}
		if flag == 1 {
			break
		}
	}

	if flag == 1 {
		fmt.Println("POSSIBLE")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}
//  [ruby]
n,m=gets.split.map(&:to_i)
all=[]
check_first=[]
check_last=[]

m.times.each do
v=gets.split.map(&:to_i)
if v[0]==1
    check_first<<v[1]
elsif v[1]==n
    check_last<<v[0]
end
    

end
#p check_last
#p check_first
if (check_first & check_last)[0]!=nil
   # p check_first & check_last
    puts "POSSIBLE"
else
puts "IMPOSSIBLE"
end
//  [ruby]
N,M=gets.split.map(&:to_i)
a1=[]
an=[]
M.times{
    a,b=gets.split.map(&:to_i)
    if a==1
        a1 << b
    end
    if a==N
        an << b
    end
    if b==1
        a1 << a
    end
    if b==N
        an << a
    end
}
if (a1 & an).empty?
    puts "IMPOSSIBLE"
else
    puts "POSSIBLE"
end
//  [ruby]
n,m = gets.strip.split.map(&:to_i)
rec1 = []
recn = []
m.times do
  a,b = gets.strip.split.map(&:to_i)
  if a==1
    rec1 << b
  elsif b == 1
    rec1 << a
  elsif a==n
    recn << b
  elsif b==n
    recn << a
  end
end
recnew = rec1+recn
if recnew.size == recnew.uniq.size
  puts "IMPOSSIBLE"
else
  puts "POSSIBLE"
end
//  [ruby]
n,m=gets.split.map(&:to_i)
start=[]
goal=[]
all=[]
m.times.each do
    v=gets.split.map(&:to_i)
    if v[1]==n
        goal<<v[0]
    elsif v[0]==1
        start<<v[1]
    end
    all<<v
end

set=start&goal


if set[0]!=nil
    puts "POSSIBLE"
else
    puts "IMPOSIBLE"
end
//  [ruby]
n,m=gets.split.map(&:to_i)
start=[]
goal=[]
all=[]
m.times.each do
    v=gets.split.map(&:to_i)
    if v[1]==n
        goal<<v[0]
    elsif v[0]==1
        start<<v[1]
    end
    all<<v
end

set=start&goal
if set.length>0
    puts "POSSIBLE"
else
    puts "IMPOSIBLE"
end
//  [ruby]
n,m=gets.split.map(&:to_i)
start=[-10]
goal=[]
all=[]
m.times.each do
    v=gets.split.map(&:to_i)
    if v[1]==n
        goal<<v[0]
    elsif v[0]==1
        start<<v[1]
    end
    all<<v
end

goal.sort!
start.sort!
for i in 0..goal.length-1
    if start.bsearch{|j|j>=goal[i]}==nil || start.bsearch{|j|j<=goal[i]}==nil
        next
    else
    v=start.bsearch{|j|j>=goal[i]}-start.bsearch{|j|j<=goal[i]}
    end
    
    if v!=nil
     
        puts "POSSIBLE"
        exit
    end
end
puts "IMPOSSIBLE"
//  [rust]
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        abs: [(usize1, usize1); m],
    }
    let mut islands = vec![0; n];
    for ab in abs.into_iter() {
        if ab.0 == 0 {
            if islands[ab.1] == 2 {
                println!("POSSIBLE");
                return;
            } else {
                islands[ab.1] = 1;
            }
        } else if ab.1 == n - 1 {
            if islands[ab.0] == 1 {
                println!("POSSIBLE");
                return;
            } else {
                islands[ab.0] = 2;
            }
        }
    }
    println!("IMPOSSIBLE");
}
//  [rust]
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
use proconio::{fastout, input};
#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        i: [(usize, usize); m],
    }
    let mut one_to_i = vec![false; n];
    let mut i_to_n = vec![false; n];
    for a in 0..m {
        if i[a].0 == 1 {
            one_to_i[i[a].1 - 1] = true;
        } else if i[a].1 == n {
            i_to_n[i[a].0 - 1] = true;
        }
    }
    for j in 0..n {
        if one_to_i[j] == true && i_to_n[j] == true {
            println!("POSSIBLE");
            return;
        }
    }
    println!("IMPOSSIBLE");
}
//  [rust]
use std::io::*;
use std::str::FromStr;
use std::cmp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::char;
use std::cmp::{min, max};
use itertools::Itertools;
use std::ops::{Add, AddAssign};
use num_integer::{Integer, gcd, lcm};
use std::collections::VecDeque;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_tuple2<T: FromStr, S: FromStr>() -> (T, S) {
    let a = read();
    let b = read();
    (a, b)
}

fn read_tuple3<T: FromStr, S: FromStr, R: FromStr>() -> (T, S, R) {
    let a = read();
    let b = read();
    let c = read();
    (a, b, c)
}

fn lower_bound<T: Copy, F>(v: &Vec<T>, f: F) -> Option<usize> where
    F: Fn(T) -> bool
{
    let mut left = 0;
    let mut right = v.len() - 1;
    if !f(v[left]) {
        return None;
    }
    if f(v[right]) {
        return Some(right);
    }
    loop {
        if right - left == 1 {
            return Some(left);
        }
        let mid = (left + right) / 2;
        if f(v[mid]) {
            left = mid;
        } else {
            right = mid;
        }
    }
}

fn main() {
    let (n, m):(u32, u32) = read_tuple2();
    let routes:Vec<(u32, u32)> = (0..m).map(|_|read_tuple2()).collect();
    let mut route_maps = HashMap::new();
    for (from, to) in routes {
        let mut ent =
            route_maps.entry(from).or_insert(Vec::with_capacity(m as usize));
        (*ent).push(to);
        let mut ent =
            route_maps.entry(to).or_insert(Vec::with_capacity(m as usize));
        (*ent).push(from);
    }
    let mut snd = Vec::with_capacity(m as usize);
    for i in route_maps.entry(1).or_insert(Vec::new()) {
        if *i == n {
            println!("POSSIBLE");
            return;
        }
        snd.push(*i);
    }
    for i in snd {
        for j in route_maps.entry(i).or_insert(Vec::new()) {
            if *j == n {
                println!("POSSIBLE");
                return;
            }
        }
    }
    println!("IMPOSSIBLE");
}
//  [swift]
import Foundation
#if os(OSX) || os(iOS)
    import Darwin
#elseif os(Linux)
    import Glibc
#endif
var n = 0, m = 0, a = 0, b = 0
withUnsafeMutablePointer(&n){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
withUnsafeMutablePointer(&m){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
var sx = UnsafeMutablePointer<Bool>.alloc(n+1)
var xe = UnsafeMutablePointer<Bool>.alloc(n+1)
memset(sx, 0, n+1)
memset(xe, 0, n+1)
for i in 0..<m {
    withUnsafeMutablePointer(&a){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
    withUnsafeMutablePointer(&b){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
    if a == 1 {
       sx.advancedBy(b).memory = true
    } else if b == n {
       xe.advancedBy(a).memory = true
    }
}
var ans = "IMPOSSIBLE"
for i in 0..<n {
    if sx.advancedBy(i).memory && xe.advancedBy(i).memory {
        ans = "POSSIBLE"
        break
    }
}
print(ans)
sx.dealloc(n+1); xe.dealloc(n+1)
//  [swift]
import Foundation
#if os(OSX) || os(iOS)
    import Darwin
#elseif os(Linux)
    import Glibc
#endif
protocol Scannable {
    static var format: String { get }
    static func scan() -> Self
}
extension Scannable {
    static func scan() -> Self {
        var arg: Self? = nil
        withUnsafeMutablePointer(&arg){withVaList([COpaquePointer($0)]){vscanf(self.format,$0)}}
        return arg!
    }
}
extension Int: Scannable { static var format: String { return "%d" } }
let n = Int.scan(), m = Int.scan()
var sx = UnsafeMutablePointer<Bool>.alloc(n+1)
var xe = UnsafeMutablePointer<Bool>.alloc(n+1)
memset(sx, 0, n+1); memset(xe, 0, n+1)
for i in 0..<m {
    let a = Int.scan(), b = Int.scan()
    if a == 1 {
        sx.advancedBy(b).memory = true
    } else if b == n {
        xe.advancedBy(a).memory = true
    }
}
var ans = "IMPOSSIBLE"
for i in 0..<n {
    if sx.advancedBy(i).memory && xe.advancedBy(i).memory {
        ans = "POSSIBLE"
        break
    }
}
print(ans)
sx.dealloc(n+1); xe.dealloc(n+1)
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
//    func enumerated() -> [(Int, Element)] {
//        return self.enumerate()
//    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // 2つの条件に優先順位をつけてソート

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, M) = (input[0], input[1])
var from1: Set<Int> = []
var toN: Set<Int> = []

for _ in 0..<M {
    let input = readIntSplit(by: " ")
    let (a, b) = (input[0], input[1])
    if a == 1 {
        from1.insert(b)
    }
    if b == N {
        toN.insert(a)
    }
}

print((from1.intersect(toN).count>0 ? "" : "IM") + "POSSIBLE")
//  [typescript]
"use strict";

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

function main(input) {
  const [firstLine, ...routes] = input.split("\n");
  const start = 1;
  const [goal, routeCount] = firstLine.split(" ").map(Number);

  const hasStart = [];
  const hasGoal = [];
  let ans = "IMPOSSIBLE";
  for(let i = 0; i < routeCount; i++) {
    const [a, b] = routes[i].split(" ").map(Number);
    if(a === start) {
      hasStart[b] = true;
      if(hasGoal[b]) {
        ans = "POSSIBLE";
        break;
      }
    } else if(b === goal) {
      hasGoal[a] = true;
      if(hasStart[a]) {
        ans = "POSSIBLE";
        break;
      }
    }
  }

  console.log(ans);
}
//  [typescript]
"use strict";

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

function main(input) {
  const [firstLine, ...routes] = input.split("\n");
  const start = 1;
  const [goal, routeCount] = firstLine.split(" ").map(Number);

  const hasStart = new Array(routeCount);
  const hasGoal = new Array(routeCount);
  let ans = "IMPOSSIBLE";
  for(let i = 0; i < routeCount; i++) {
    const [a, b] = routes[i].split(" ").map(Number);
    if(a === start) {
      hasStart[b] = true;
      if(hasGoal[i]) {
        ans = "POSSIBLE";
        break;
      }
    } else if(b === goal) {
      hasGoal[a] = true;
      if(hasStart[i]) {
        ans = "POSSIBLE";
        break;
      }
    }
  }

  console.log(ans);
}
//  [typescript]
"use strict";

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

function main(input) {
  const inputs = input.split("\n");
  const start = 1;
  const [goal, routeCount] = inputs[0].split(" ").map(Number);

  const hasStart = new Array(routeCount);
  const hasGoal = new Array(routeCount);
  let ans = "IMPOSSIBLE";
  for(let i = 1; i <= routeCount; i++) {
    const [a, b] = inputs[i].split(" ").map(Number);
    if(a === start) {
      hasStart[b] = true;
      if(hasGoal[i]) {
        ans = "POSSIBLE";
        break;
      }
    } else if(b === goal) {
      hasGoal[a] = true;
      if(hasStart[i]) {
        ans = "POSSIBLE";
        break;
      }
    }
  }

  console.log(ans);
}
//  [typescript]
"use strict";

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

function main(input) {
  const inputs = input.split("\n");
  const start = 1;
  const [goal, routeCount] = inputs[0].split(" ").map(Number);

  const hasStart = new Array(routeCount);
  const hasGoal = new Array(routeCount);
  let ans = "IMPOSSIBLE";
  for(let i = 1; i <= routeCount; i++) {
    const [a, b] = inputs[i].split(" ").map(Number);
    if(a === 1) {
      hasStart[i] = true;
      if(hasGoal[i]) {
        ans = "POSSIBLE";
        break;
      }
    } else if(b === goal) {
      hasGoal[i] = true;
      if(hasStart[i]) {
        ans = "POSSIBLE";
        break;
      }
    }
  }
  
  console.log(ans);
}
//  [python]
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


def solve():
    _ = int(rl())
    A = list(map(int, rl().split()))
    
    one = A.count(1)
    if one == 1:
        print(1)
        return
    if 2 <= one:
        print(0)
        return
    
    counter = [0] * (10 ** 6 + 1)
    for ai in A:
        for m in range(ai, 10 ** 6 + 1, ai):
            counter[m] += 1
    
    ans = 0
    for ai in A:
        if counter[ai] == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()
//  [python]
N=int(input())
A=list(map(int,input().split()))
M=max(A)

F=[0]*(M+1)

for i in range(N):
    a=A[i]
    b=a
    while b<=M:
        F[b]+=1
        b+=a
    

T=0
for i in range(N):
    if F[A[i]]==1:
        T+=1

print(T)
//  [python]
n = int(input())
a = list(map(int, input().split()))

b = [0] * (max(a) + 1)
# b[i] = (aの要素がiであるような数)
for i in range(n):
    b[a[i]] += 1

ans = 0
for i in range(1, len(b)):
    if b[i] > 0:
        if b[i] == 1:
            ans += 1
        # print(i, ans)
        for j in range(len(b)):
            if i * j >= len(b):
                break
            b[i * j] = 0

print(ans)