stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

} 

// Faster C++ solution for the same problem (measured speedup: 1.820921312302899x):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<cmath>

#include<algorithm>

#include<set>

//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector

//#include<bits/stdc++.h>

#define ll long long

using namespace std;



int main()

{

	ios::sync_with_stdio(false);

	set<int> s1,s2;

	int n,m,a,b;

	cin>>n>>m;

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

		cin>>a>>b;

		if(a==1){

			s1.insert(b);

		}

		if(b==1) s1.insert(a);

		if(a==n) s2.insert(b);

		if(b==n) s2.insert(a);

 	}

 	int f=0;

 	for(set<int>::iterator it=s1.begin() ;it!=s1.end();it++)

    {

        if(s2.find(*it)!=s2.end()){

			cout<<"POSSIBLE"<<endl;

			f=1;

			break;

        }

    }

 	if(f==0){

		cout<<"IMPOSSIBLE"<<endl;

 	}



return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 6.541766401365618x):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<cmath>

#include<algorithm>

#include<set>

//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector

//#include<bits/stdc++.h>

#define ll long long

using namespace std;



int main()

{

	ios::sync_with_stdio(false);

	set<int> s1,s2;

	int n,m,a,b;

	cin>>n>>m;

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

		cin>>a>>b;

		if(a==1){

			s1.insert(b);

		}

		if(b==1) s1.insert(a);

		if(a==n) s2.insert(b);

		if(b==n) s2.insert(a);

 	}

 	int f=0;

 	for(set<int>::iterator it=s1.begin() ;it!=s1.end();it++)

    {

        if(s2.find(*it)!=s2.end()){

			cout<<"POSSIBLE"<<endl;

			f=1;

			break;

        }

    }

 	if(f==0){

		cout<<"IMPOSSIBLE"<<endl;

 	}



return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.568276330792696x):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<cmath>

#include<algorithm>

#include<set>

//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector

//#include<bits/stdc++.h>

#define ll long long

using namespace std;



int main()

{

	ios::sync_with_stdio(false);

	set<int> s1,s2;

	int n,m,a,b;

	cin>>n>>m;

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

		cin>>a>>b;

		if(a==1){

			s1.insert(b);

		}

		if(b==1) s1.insert(a);

		if(a==n) s2.insert(b);

		if(b==n) s2.insert(a);

 	}

 	int f=0;

 	for(set<int>::iterator it=s1.begin() ;it!=s1.end();it++)

    {

        if(s2.find(*it)!=s2.end()){

			cout<<"POSSIBLE"<<endl;

			f=1;

			break;

        }

    }

 	if(f==0){

		cout<<"IMPOSSIBLE"<<endl;

 	}



return 0;

}
// Slower C++ solution:
#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;

 } 

// Faster C++ solution for the same problem (measured speedup: 1.49801369693381x):
#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;

}
// Slower C++ solution:
#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;

} 

// Faster C++ solution for the same problem (measured speedup: 1.5518263102416696x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.57502685508986x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.1887375117020302x):
#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;

}
// Slower C++ solution:
#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;

 } 

// Faster C++ solution for the same problem (measured speedup: 1.7954845603511709x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1721639745407346x):
#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;

}
// Slower C++ solution:
#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;

} 

// Faster C++ solution for the same problem (measured speedup: 1.859983113698296x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 6.682098209345862x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.6233701447231x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1985768648352384x):
#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;

}
// Slower C++ solution:
//#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;

}

// Faster C++ solution for the same problem (measured speedup: 3.408425828747718x):
//#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.940858909989626x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.7687604269373174x):
#include<bits/stdc++.h>

using namespace std;

int a[200010];

int flag;

int n,m;

int main() {

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

	flag=0;

	int u,v;

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

		a[i]=0;

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

		scanf("%d%d",&u,&v);

		if(flag)

			continue;

		if(u==1) {

			if(a[v]) {

				flag=1;

			}

			a[v]=1;

		}



		else if(v==n) {

			if(a[u]) {

				flag=1;

			}

			a[u]=1;

		}



	}

	if(flag)

		printf("POSSIBLE\n");

	else printf("IMPOSSIBLE\n");



	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.7051531318739404x):
#include<iostream>

#include<cstdio>

using namespace std;

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

int main()

{

    cin>>n>>m;

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

    {

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

        if(a==1)

            x[b]++;

        if(b==n)

            x[a]++;

    }

    int flag=0;

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

    {

        if(x[i]==2)

        {

            flag=1;

            break;

        }

    }

    if(flag==1)

        cout<<"POSSIBLE"<<endl;

    else

        cout<<"IMPOSSIBLE"<<endl;

}