stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define endl '\n'



using namespace std;



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(0);



  int p, q, r;

  cin >> p >> q >> r;

  cout << min(p + q, min(p + r, r + q)) << endl;



  return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

using namespace std;

int a[5];

int main()

{

    int temp;

    for(int i=0; i<3; i++)

    {

        scanf("%d",&a[i]);

    }

    for(int i=0; i<2; i++)

    {

        for(int j=i+1; j<3; j++)

        {

            if(a[i]>a[j])

            {

                temp=a[i];

                a[i]=a[j];

                a[j]=temp;

            }

        }

    }

    printf("%d",a[0]+a[1]);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{



    int p=0;

    int q=0;

    int r=0;

    int v=0;

    int b=0;

    int m=0;

    int l=0;

    cin>>p;

    cin>>q;

    cin>>r;

    if((p==q)&&(p==r)){

    l=p+q;

    goto me;

}

else if(((p==q)&&(p!=r))&&p>r){



    l=p+r;

    goto me;

}

else if(((p==q)&&(p!=r))&&p<r){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p>q){

    l=p+q;

    goto me;

}

else if(((p==r)&&(p!=q))&&p<q){

    l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r>p){

l=p+r;

    goto me;

}

else if(((r==q)&&(r!=p))&&r<p){

   l=r+q;

    goto me;

    }







        else if(p<q&&p<r){

            m=p;

         }



         else if(q<p&&q<r){

            m=q;

         }



          else if(r<p&&r<q){

            m=r;

         }

        if((p<q&&p>r)||(p<r&&p>q)){



            b=p;

         }

         else if((q<p&&q>r) || (q<r&&q>p)){

            b=q;

         }

         else if((r<q&&r>p) || (r<p&&r>q)){

            b=r;

         }







l=m+b;

me:

cout << l;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

using namespace std;

int a[5];

int main()

{

    int temp;

    for(int i=0; i<3; i++)

    {

        scanf("%d",&a[i]);

    }

    for(int i=0; i<2; i++)

    {

        for(int j=i+1; j<3; j++)

        {

            if(a[i]>a[j])

            {

                temp=a[i];

                a[i]=a[j];

                a[j]=temp;

            }

        }

    }

    printf("%d",a[0]+a[1]);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<math.h>

#include<bits/stdc++.h>

#include<string.h>

#include<algorithm>

using namespace std;

int a[5];

int main()

{

    for(int i=1; i<=3; i++)

        scanf("%d",&a[i]);

    sort(a+1,a+4);

    printf("%d\n",a[1]+a[2]);

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

using namespace std;

int a[5];

int main()

{

    int temp;

    for(int i=0; i<3; i++)

    {

        scanf("%d",&a[i]);

    }

    for(int i=0; i<2; i++)

    {

        for(int j=i+1; j<3; j++)

        {

            if(a[i]>a[j])

            {

                temp=a[i];

                a[i]=a[j];

                a[j]=temp;

            }

        }

    }

    printf("%d",a[0]+a[1]);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for(int i=a;i<=b;i++)

#define dep(i,a,b) for(int i=a;i>=b;i--)

#define N 500005

#define inf 666666666

int in[N],pos[N],p[N],ans[N],tot,n,k;

priority_queue <int> q;

int head[N],to[N<<1],nxt[N<<1],cnt;

void add(int u,int v)

{

	cnt++;

	to[cnt]=v;

	nxt[cnt]=head[u];

	head[u]=cnt;

}

#define ls id<<1

#define rs id<<1|1

int t[N<<2];

void change(int id,int l,int r,int p,int d)

{

	if(l==r) {

		t[id]=d;

		return;

	}

	int mid=(l+r)>>1;

	if(p<=mid) change(ls,l,mid,p,d);

	else change(rs,mid+1,r,p,d);

	t[id]=min(t[ls],t[rs]);

}

int query(int id,int L,int R,int l,int r)

{

	if(t[id]>=N) return inf;

	if(l==L&&r==R) return t[id];

	int Mid=(L+R)>>1;

	if(r<=Mid) return query(ls,L,Mid,l,r);

	else if(l>Mid) return query(rs,Mid+1,R,l,r);

	else return min(query(ls,L,Mid,l,Mid),query(rs,Mid+1,R,Mid+1,r));

}

int main()

{

	int tmp;

	scanf("%d%d",&n,&k);

	rep(i,1,n) 

		scanf("%d",&tmp),p[tmp]=i;

	memset(t,0x3f,sizeof(t));

	dep(i,n,1) {

		int pos=query(1,1,n,p[i],min(n,p[i]+k-1));

		if(pos!=inf) {

			add(p[i],p[pos]);

			in[p[pos]]++;

		}

		pos=query(1,1,n,max(1,p[i]-k+1),p[i]);

		if(pos!=inf) {

			add(p[i],p[pos]);

			in[p[pos]]++;

		}

		change(1,1,n,p[i],i);

	}

	rep(i,1,n) if(!in[i]) q.push(-i);

	while(!q.empty()) {

		int now=-q.top();

		ans[now]=++tot;

		q.pop();

		for(int i=head[now]; i; i=nxt[i]) {

			int v=to[i];

			--in[v];

			if(!in[v]) q.push(-v);

		}

	}

	rep(i,1,n) printf("%d\n",ans[i]);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int maxn=5e5+5;

const int INF=1e7+5;

priority_queue<int,vector<int>,greater<int> > q;

int n,k;

int A[maxn],ans[maxn],ind[maxn];

int tot;

int h[maxn],last[maxn<<1],to[maxn<<1];

int st[maxn<<2];

void build(int x,int l,int r)

{

	st[x]=INF;

	if(l==r) return;

	int mid=(l+r)>>1;

	build(x<<1,l,mid),build(x<<1|1,mid+1,r);

} 

void pushup(int x)

{

	st[x]=min(st[x<<1],st[x<<1|1]);

}

void update(int x,int l,int r,int id,int k)

{

	if(l==r){

		st[x]=k;

		return;

	}

	int mid=(l+r)>>1;

	if(id<=mid) update(x<<1,l,mid,id,k);

	else update(x<<1|1,mid+1,r,id,k);

	pushup(x);

}

int query(int x,int l,int r,int ql,int qr)

{

	if(r<ql||l>qr) return INF;

	if(l>=ql&&r<=qr) return st[x];

	int mid=(l+r)>>1;

	return min(query(x<<1,l,mid,ql,qr),query(x<<1|1,mid+1,r,ql,qr));

}

void add(int x,int y)

{

	to[++tot]=y;last[tot]=h[x];h[x]=tot;++ind[y];

}

int main()

{

	scanf("%d%d",&n,&k);

	for(int i=1;i<=n;++i){

		int a=0;

		scanf("%d",&a);

		A[a]=i;

	}

	build(1,1,n);

	for(int i=n;i>=1;--i){

		int l=query(1,1,n,A[i],A[i]+k-1),r=query(1,1,n,A[i]-k+1,A[i]);

		if(l!=INF) add(A[i],A[l]);

		if(r!=INF) add(A[i],A[r]);

		update(1,1,n,A[i],i);

	}

	for(int i=1;i<=n;++i) if(!ind[i]) q.push(i);

	int cnt=0;

	while(q.size()){

		int u=q.top();

		q.pop();

		ans[u]=++cnt; 

		for(int i=h[u];i;i=last[i]){

			int v=to[i];

			if(!--ind[v]) q.push(v);

		}

	}

	for(int i=1;i<=n;++i) printf("%d\n",ans[i]);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

using namespace std;

vector<int>v[200001];

int arr[200001];

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=0;i<m;i++)

	{

		int a,b;

		cin>>a>>b;

		v[a].push_back(b);

		v[b].push_back(a);

		if(a==n)

		{

			arr[b]=1;

		}

		else if(b==n)

		{

			arr[a]=1;

		}

	}

	for(int i=0;i<v[1].size();i++)

	{

		if(arr[v[1][i]]==1)

		{

			cout<<"POSSIBLE";

			return 0;

		}

	}

				cout<<"IMPOSSIBLE";



	return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

#define LL long long

#define MAX 0X3f3f3f3f

#define maxn 200000+10

int vis[200006];

map<int,int>mmp;

int main()

{

    int n,m;

    cin>>n>>m;

    //1-n是否路径只有2

    string s2="IMPOSSIBLE";

    for(int i=1;i<=m;i++)

    {

        int a,b;

        cin>>a>>b;

        if(a==1)

        {

            if(vis[b])

            {

                s2="POSSIBLE";

            }

            vis[b]=1;

        }

        if(b==n)

        {

            if(vis[a])

            {

                s2="POSSIBLE";

            }

            vis[a]=1;

        }

    }

    cout<<s2<<endl;

    for(int i=1;i<=n;i++)

    {



    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)

#define ALL(v) (v).begin(),(v).end()

template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}

template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}

template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}

template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}





int nextInt() { int x; scanf("%d", &x); return x;}



const int MAX_N = 200000 + 10;

int e[MAX_N];



int main2() {

  int N = nextInt();

  int M = nextInt();

  memset(e, 0, sizeof(e));

  REP(_, M) {

    int a = nextInt() - 1;

    int b = nextInt() - 1;

    if (a == 0) { e[b] |= 1; }

    if (a == N-1) { e[b] |= 2; }

    if (b == 0) { e[a] |= 1; }

    if (b == N-1) { e[a] |= 2; }

  }



  bool possible = false;

  REP(i, N) if (e[i] == 3) possible = true;

  cout << (possible ? "POSSIBLE" : "IMPOSSIBLE") << endl;

  return 0;

}



int main() {

  for (;!cin.eof();cin>>ws) main2();

  return 0;

}




// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)

#define ALL(v) (v).begin(),(v).end()

#define CLR(t,v) memset(t,(v),sizeof(t))

template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}

template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}

template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}

template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}



int nextInt() { int x; scanf("%d", &x); return x;}



const int MAX_N = 212345;

bool canA[MAX_N];

bool canB[MAX_N];



int main2() {

  CLR(canA, 0);

  CLR(canB, 0);

  int N = nextInt();

  int M = nextInt();

  REP(i, M) {

    int a = nextInt();

    int b = nextInt();

    if (a > b) swap(a, b);



    if (a == 1) canA[b] = true;

    if (b == N) canB[a] = true;

  }

  bool ok = false;

  for (int i = 1; i <= N; i++) if (canA[i] && canB[i]) ok = true;

  cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;

  return 0;

}



int main() {

  for (;!cin.eof();cin>>ws)

    main2();

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cmath>

using namespace std;

int a[100005];

int main()

{

	int n,m,a,b;

	int x[200005]={0};

	scanf("%d%d",&n,&m);

	for(int i=0;i<m;i++)

	{

		scanf("%d%d",&a,&b);

		if(a==1)

		{

			x[b]++;

		}

		else if(b==1)

		{

			x[a]++;

		}

		if(a==n)

		{

			x[b]++;

		}

		else if(b==n)

		{

			x[a]++;

		}

	}

	for(int i=1;i<=m;i++)

	{

		if(x[i]>1)

		{

			printf("POSSIBLE\n");

			return 0;

		}

	}

	printf("IMPOSSIBLE\n");

	return 0;

 } 

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



#include <vector>



#include <queue>



using namespace std;



const int N = 1000 * 1000 * 1000 + 7;

vector<int> adj[200005];

int dis[200005];

queue<int> q;

int main()

{

	int n, m;

	cin >> n;

	cin >> m;

	for(int i = 0; i < m; i ++)

	{

		int x, y;

		cin >> x;

		cin >> y;

		adj[x].push_back(y);

		adj[y].push_back(x);

	}

	for(int i = 2; i <= n; i ++)

	{

		dis[i] = N;

	}

	dis[1] = 0;

	q.push(1);

	while(q.size())

	{

		int v = q.front();

		q.pop();

		for(int i = 0; i < adj[v].size(); i ++)

		{

			if(dis[adj[v][i]] == N)

			{

				dis[adj[v][i]] = dis[v] + 1;

				q.push(adj[v][i]);

			}

		}

	}

	if(dis[n] == 2)

	{

		cout << "POSSIBLE";

	}

	else

	{

		cout << "IMPOSSIBLE";

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#define max 200000

using namespace std;

int main(){

	int n,m,i,k=0,j,h=0,c,b;

	int a[max]={0};

	cin>>n>>m;

	for(i=0;i<m;i++){

		cin>>c>>b;

		if(c==1)a[b]++;

		else if(b==1)a[c]++;

		else if(b==n)a[c]++;

		else if(c==n)a[b]++;

	}

	

	for(i=0;i<n;i++){

	if(a[i]==2){

	cout<<"POSSIBLE"<<endl;

	return 0;

   }

	

	

}

    cout<<"IMPOSSIBLE"<<endl;

	return 0;

} 

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<queue>

#include<algorithm>

#include<cstring>

using namespace std;

const int N=2e5;

int head[N+5];

struct mode

{

	int v,nxt;

}edge[2*N+5];

int d[N+5];

int vis[N+5];

priority_queue<pair<int,int> > q;

int cnt=1;



void add(int u,int v)

{

	edge[cnt].v=v;

	edge[cnt].nxt=head[u];

	head[u]=cnt++;

}



void dijkstra()

{

	memset(d,0x3f,sizeof(d));

	memset(vis,0,sizeof(vis));

	d[1]=0;

	q.push(make_pair(0,1));

	while(!q.empty())

	{

		int x=q.top().second;

		q.pop();

		if(vis[x])

			continue;

		vis[x]=1;

		for(int i=head[x];i;i=edge[i].nxt)

		{

			int y=edge[i].v;

			if(d[y]>d[x]+1)

			{

				d[y]=d[x]+1;

				q.push(make_pair(-d[y],y));

			}

		}

	}

}



int main()

{

	ios::sync_with_stdio(false);

	int n,m;

	cin>>n>>m;

	for(int i=0;i<m;++i)

	{

		int u,v;

		cin>>u>>v;

		add(u,v);

	}

	dijkstra();

	//cout<<d[n]<<endl;

	if(d[n]<=2)

		cout<<"POSSIBLE"<<endl;

	else

		cout<<"IMPOSSIBLE"<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

const int maxn=200010;

int a1[maxn],a2[maxn];

int n,m;

int main(){

	cin>>n>>m;

	for(int i=0;i<m;i++){

		int x,y;

		cin>>x>>y;

		if(x==1) a1[y]=1;

		if(y==n) a2[x]=1;

	}

	for(int i=2;i<n;i++){

		if(a1[i]&&a2[i]){

			cout<<"POSSIBLE"<<endl;

			return 0;

		}

	}

	cout<<"IMPOSSIBLE"<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

using namespace std;

int i,j,t,m,x[200003]= {0},a,b,num=0,num1=0;

int main()

{

    cin>>t>>m;

    for(i=0; i<m; i++)

    {

        scanf("%d %d",&a,&b);

        if(a==1)

            x[b]++;

        if(b==t)

            x[a]++;

    }

    int flag=0;

    for(i=0; i<t; i++)

    {

        if(x[i]==2)

        {

            flag=1;

            break;

        }

    }

    if(flag==1)

        cout<<"POSSIBLE"<<endl;

    else

        cout<<"IMPOSSIBLE"<<endl;

}

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//#include<bits/stdc++.h>

#include<cstdio>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



const int cm = 1 << 17;

char cn[cm], * ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



int main() {

	//cin.tie(0);

	//ios::sync_with_stdio(false);





	int N = getint(), M = getint();

	bool A[200001] = {}, B[200001] = {};

	rep(i, M) {

		int a = getint(), b = getint();

		if (a == 1) A[b] = 1;

		if (b == N) B[a] = 1;

	}



	int ikeru = 0;

	rep1(i, N) if (A[i] && B[i]) ikeru = 1;



	if (ikeru) printf("POSSIBLE");

	else printf("IMPOSSIBLE");



	Would you please return 0;

}

// Optimized solution to the same problem (faster):
//#include<bits/stdc++.h>

#include<cstdio>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



const int cm = 1 << 17;

char cn[cm], * ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



bool A[200001];



int main() {

	//cin.tie(0);

	//ios::sync_with_stdio(false);



	//かしこいなぁ

	int N = getint(), M = getint();

	int ikeru = 0;

	rep(i, M) {

		int a = getint(), b = getint();

		if (a == 1) {

			if (A[b]) ikeru = 1;

			else A[b] = 1;

		}

		if (b == N) {

			if (A[a]) ikeru = 1;

			else A[a] = 1;

		}

	}



	if (ikeru) printf("POSSIBLE");

	else printf("IMPOSSIBLE");



	Would you please return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <vector>

#include <vector>

#define N 200005

using namespace std;



int n, m, s;

bool v[N];

vector<int> a[N];

void f(int p, int q) {

	int i;

	if (q > 2) return;

	if (v[p]) return;

	v[p] = true;

	for (i = 0; i < a[p].size(); i++) {

		f(a[p][i], q + 1);

	}

}

int main()

{

	int i, t1, t2;

	cin >> n >> m;

	for (i = 0; i < m; i++) {

		scanf ("%d %d", &t1, &t2);

		a[t1].push_back(t2);

		a[t2].push_back(t1);

	}

	f(1, 0);

	if (v[n]) cout << "POSSIBLE" << endl;

	else cout << "IMPOSSIBLE" << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <cstdio>

using namespace std;



int n, m, t1, t2;

bool v[200005][2];

int main()

{

	int i;

	scanf ("%d %d", &n, &m);

	while (m--) {

		scanf ("%d %d", &t1, &t2);

		if (t2 == n) v[t1][1] = 1;

		if (t1 == 1) v[t2][0] = 1;

	}

	for (i = 2; i< n; i++) {

		if (v[i][0] && v[i][1]) {

			cout << "POSSIBLE";

			return 0;

		}

	}

	cout << "IMPOSSIBLE";

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<iostream>

using namespace std;

#define ll long long

int isb[200005];

int ise[200005];

int main()

{

    int n,m,a,b;

    while(cin >> n >> m)

    {

        memset(isb,0,sizeof(isb));

        memset(ise,0,sizeof(ise));

        while(m--)

        {

            cin >> a >> b;

            if(a == 1)

                isb[b] = 1;

            else if(a == n)

                ise[b] = 1;

            if(b == 1)

                isb[a] = 1;

            else if(b == n)

                ise[a] = 1;

        }

        int i;

        for(i = 1;i <= n;i++)

        {

            if(isb[i] && ise[i])

            {

                cout << "POSSIBLE" << endl;

                break;

            }

        }

        if(i == n + 1)

        cout << "IMPOSSIBLE" << endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

using namespace std;

vector<int>v[200001];

int arr[200001];

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=0;i<m;i++)

	{

		int a,b;

		cin>>a>>b;

		v[a].push_back(b);

		v[b].push_back(a);

		if(a==n)

		{

			arr[b]=1;

		}

		else if(b==n)

		{

			arr[a]=1;

		}

	}

	for(int i=0;i<v[1].size();i++)

	{

		if(arr[v[1][i]]==1)

		{

			cout<<"POSSIBLE";

			return 0;

		}

	}

				cout<<"IMPOSSIBLE";



	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define N 1000001



int arrr1[N+5],arrr2[N+5];

int main()

{

    int n,m,a,b;



    cin>>n>>m;

    for(int i=0; i<m; i++)

    {

        cin>>a>>b;

        if(a==1)

            arrr1[b]=1;//第一次的终点

        if(b==n)

            arrr2[a]=1;//第二次的起点

    }



    int p=0;

    for(int i=1; i<=m; i++)

    {

        if(arrr1[i]&&arrr2[i])

        {

            cout<<"POSSIBLE"<<endl;

            p=1;

        }

    }



    if(p==0)

        cout<<"IMPOSSIBLE"<<endl;



    return 0;

}




// Fastest known solution for this problem: