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

using namespace std;

const int N=200005;

int n,m,x,y;

bool b[N],c[N];

int main()

{

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

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

		scanf("%d%d",&x,&y);

		if(x==1)b[y]=true;

		if(y==n)c[x]=true;

	}

	c[1]=true;

	b[n]=true;

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

		if(b[i]&&c[i]){

			puts("POSSIBLE");

			return 0;

		}

	puts("IMPOSSIBLE");

	return 0;

}

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

#include<cstdio>

#include<cstdlib>

#include<map>

#include<cstring>

#include<algorithm>

#define ll long long

#define Max(x,y) ((x) > (y) ? (x) : (y))

#define Min(x,y) ((x) < (y) ? (x) : (y))

#define mod 1000000007

#define N 200010

using namespace std;

inline int read(){

	int x = 0,f = 1;char ch = getchar();

	while(ch < '0' || ch > '9'){if(ch == '-')f = -1;ch = getchar();}

	while(ch >= '0' && ch <= '9'){x = x*10+ch-'0';ch = getchar();}

	return x*f;

}



int n,m;

int nxt[N*2],to[N*2],head[N],cnt;



void add(int x,int y){

	to[++cnt] = y; nxt[cnt] = head[x]; head[x] = cnt;

	to[++cnt] = x; nxt[cnt] = head[y]; head[y] = cnt;

}



int main(){

	n = read(); m = read();

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

		int x = read(),y = read();

		add(x,y);

	}

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

		if(to[i] == n){

			puts("POSSIBLE");

			return 0;

		}

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

			if(to[j] == n){

				puts("POSSIBLE");

				return 0;

			}

		}

	}

	puts("IMPOSSIBLE");

	return 0;

}

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

#include<cstring>

#include<algorithm>

#include<map>

#define ll long long

#define N 200005

#define mod 1000000007

#define rep(i,j,k) for (ll i=j;i<=k;++i)

#define per(i,j,k) for (ll i=j;i>=k;--i)

using namespace std;

inline ll read(){

	char ch=getchar(); ll x=0,f=1;

	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }

	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }

	return x*f;

}

map<ll,ll>mp[N];

ll n,m;

int main(){

	n=read(); m=read();

	rep(i,1,m){

		ll u=read(),v=read();

		mp[u][v]=1; mp[v][u]=1;

	}

	rep(i,2,n-1) if (mp[1][i]&&mp[i][n]) return puts("POSSIBLE")&0;

	puts("IMPOSSIBLE");

}

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

#include<iostream>

#include<algorithm>

#include<math.h>

#include<stdlib.h>

#include<string.h>

#include<string>

#include<set>

#include<vector>

#include<bitset>

#include<map>

#define N 200005

#define ll long long

#define oo 100000000

#define For(i,x,y) for(int i=x;i<=y;i++)

#define Rep(i,x,y) for(int i=x;i>=y;i--)

#define Forn(i,x,y) for(int i=x;i<y;i++)

using namespace std;

inline int read(){int x=0,f=0;char ch=getchar();for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;return f?-x:x;}

inline void write(ll x){if(x<10) putchar(x+48);else write(x/10),putchar(x%10+48);}

inline void writeln(ll x){if(x<0) putchar('-'),x=-x;write(x);putchar('\n');}

int n,m,st[N],ed[N];

int main(){

	n=read();m=read();

	For(i,1,m){

		int x=read(),y=read();

		if(x>y) swap(x,y);

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

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

	}

	For(i,1,n) if(st[i]&&ed[i]){puts("POSSIBLE");return 0;}

	puts("IMPOSSIBLE");

	return 0;

}

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

using namespace std;

int read(){

	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();

	int kk=1,k=0;if (c=='-')kk=-1,c=getchar();

	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();return kk*k;

}int n,m,f[1000000],x,y;

struct lsg{int x,y;}a[1000000];

int pd(lsg x,lsg y){return x.y<y.y;}

int main(){

	n=read();m=read();memset(f,10,sizeof(f));f[1]=0;

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

		x=read();y=read();

		a[i].x=x;a[i].y=y;

	}sort(a+1,a+1+m,pd);

	for (int i=1;i<=m;i++)f[a[i].y]=min(f[a[i].x]+1,f[a[i].y]);

	if (f[n]<=2)puts("POSSIBLE");else puts("IMPOSSIBLE");

}


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

#include<iostream>

#include<algorithm>

#include<math.h>

#include<stdlib.h>

#include<string.h>

#include<string>

#include<set>

#include<vector>

#include<bitset>

#include<map>

#define N 200005

#define ll long long

#define oo 100000000

#define For(i,x,y) for(int i=x;i<=y;i++)

#define Rep(i,x,y) for(int i=x;i>=y;i--)

#define Forn(i,x,y) for(int i=x;i<y;i++)

using namespace std;

inline int read(){int x=0,f=0;char ch=getchar();for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;return f?-x:x;}

inline void write(ll x){if(x<10) putchar(x+48);else write(x/10),putchar(x%10+48);}

inline void writeln(ll x){if(x<0) putchar('-'),x=-x;write(x);putchar('\n');}

int n,m,st[N],ed[N];

int main(){

	n=read();m=read();

	For(i,1,m){

		int x=read(),y=read();

		if(x>y) swap(x,y);

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

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

	}

	For(i,1,n) if(st[i]&&ed[i]){puts("POSSIBLE");return 0;}

	puts("IMPOSSIBLE");

	return 0;

}

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

using namespace std;



typedef long long ll;

#define mp make_pair

#define pb push_back

#define pi pair<ll,ll>

#define ff first

#define ss second

#define MAX 200550

const ll MOD = 1000000007;



vector<int>g[MAX];

int main(){

	ios_base::sync_with_stdio(0); cin.tie(0);



	int t=1;

//	cin>>t;

	while(t--){

	 int n,m;

	 cin>>n>>m;

	 

	 while(m--)

	 {

	 	int u,v;

	 	cin>>u>>v;

	 	

	 	g[u].pb(v);

	 	g[v].pb(u);

	 }

	 for(auto elm:g[1])

	 {

	 	for(auto f:g[elm])

	 	{

	 		if(f==n)

	 		{

	 			cout<<"POSSIBLE\n";

	 			return 0;

			 }

		 }

	 }

	 cout<<"IMPOSSIBLE\n";

	}		

}

// Optimized solution to the same problem (faster):
///Bismillahir Rahmanir Rahim

#include<bits/stdc++.h>

using namespace std;

#define     FAST        ios_base::sync_with_stdio(false);cin.tie(NULL)

#define     int 	    long long

#define 	pb 	        push_back

#define 	mp 	        make_pair

#define 	pi 	        2*acos(0.0)

#define     scan(i)     scanf("%lld",&i)

#define     scann(i,j)  scanf("%lld%lld",&i,&j)

#define     print(i)    printf("%lld\n",i)

#define     printt(i,j) printf("%lld %lld\n",i,j)

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

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

#define 	vect 	    vector<int>

#define 	vec_it 	    vector<int>::reverse_iterator vi

#define     sorta(v)    sort(v.begin(),v.end())

#define     sortd(v)    sort(v.begin(),v.end(),greater<>())

#define     sorted      is_sorted(v.begin(),v.end())

#define 	mapp 	    map<int,int>

#define 	pairr 	    pair<int,int>

#define 	sett	    set<int>

#define 	set_it 	    set<int>::reverse_iterator si

#define     map_it      map<int,int> :: reverse_iterator mi

#define 	yes 	    cout<<"YES"<<endl

#define 	no 	        cout<<"NO"<<endl

#define 	ff 	        first

#define 	ss 	        second

#define     mx          INT_MAX

#define     lmx         LLONG_MAX

#define     mn          INT_MIN

#define     lmn         LLONG_MIN

#define     GCD         __gcd(a,b)

#define     LCM         (a/GCD)*b

template <typename T> T gcd(T a,T b){return (b==0)?a:gcd(b,a%b);}

template <typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}

int modulo (int a, int b) { return a >= 0 ? a % b : ( b - abs ( a%b ) ) % b; }



void solve()

{

  //  freopen ("(input).txt" , "r",  stdin) ;

  //  string st,stt ;

  //  int low=0,high=0;

  //  int l=0,r;

    int n,k,t,x,y,z,d=0,temp=0,cnt=0,sum=0,f=0;

    cin>>n>>k  ; vect v ,a ,b  ; sett s ; set_it ; mapp m,mm ;  map_it ; pairr p[k] ;

    loop(i,k)

    {

        cin>>p[i].ff>>p[i].ss;

        if(p[i].ff==1)

            m[p[i].ss]++;

    }

    loop(i,k)

    {

        if(m[p[i].ff]>0&&p[i].ss==n)

        {

            temp=1;break;

        }



    }

    if(temp==1)

        cout<<"POSSIBLE"<<endl;

    else

        cout<<"IMPOSSIBLE"<<endl;





}



main()

{

    int t;

  //  cin>>t;

  //  while(t--)

        solve();

}


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

using namespace std;



int n, m;

vector<int>E[200005];

bool vis[200005];



void dfs(int Now,int dep){

    if(Now == n){

        puts("POSSIBLE");

        exit(0);

    }

    else if(dep > 1) return;

    for(auto Nex : E[Now]){

        if( !vis[Nex] ){

            vis[Nex] = true;

            dfs(Nex, dep + 1);

            //vis[Nex] = false;

        }

    }

}



int main(){

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

    while(m--){

        int x,y;

        scanf("%d%d",&x,&y);

        E[x].push_back(y);

        E[y].push_back(x);

    }

    dfs(1, 0);

    printf("IMPOSSIBLE");

    return 0;



}


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

using namespace std;



int n, m;

bool vis[200005];

vector<int>E;



int main(){

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

    E.push_back(1);

    while(m--){

        int x,y;

        scanf("%d%d",&x,&y);

        if(x == n) vis[y] = true;

        if(y == n) vis[x] = true;

        if(x == 1) E.push_back(y);

        if(y == 1) E.push_back(x);

    }

    for(auto Pos : E){

        if( vis[Pos] == true ){

            printf("POSSIBLE");

            exit(0);

        }



    }

    printf("IMPOSSIBLE");

    return 0;



}


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

#include <vector>

#include <queue>

#include <string.h>

using namespace std;



int d[200005];

const int inf = 200005;

vector<int> v[200005];



void bfs(void)

{

    d[1] = 0;



    queue<int> q;



    q.push(1);



    while (!q.empty())

    {

        int t = q.front();q.pop();



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

        {

            int tt = v[t][i];



            if (d[t] + 1 < d[tt])

            {

                d[tt] = d[t] + 1;



                q.push(tt);

            }

        }

    }

}



int main()

{

    memset(d,inf,sizeof(d));



    int n,m;



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



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

    {

        int a,b;



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



        v[a].push_back(b);

    }



    bfs();



    if (d[n] == 2) printf("POSSIBLE\n");

    else printf("IMPOSSIBLE\n");



    return 0;

}


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

#include <string.h>



bool from[200005];

bool to[200005];



int main()

{

    int n,m;



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



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

    {

        int a,b;



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



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

        if (b == n) to[a] = 1;

    }



    bool ans = 0;



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

    {

        if (from[i] && to[i])

        {

            ans = 1;

            break;

        }

    }



    if (ans) printf("POSSIBLE\n");

    else printf("IMPOSSIBLE\n");



    return 0;

}


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

#include <fstream>

#include <cstdio>

#include <cassert>

#include <complex>

#include <cmath>

#include <algorithm>

#include <vector>

#include <string>

#include <cstdlib>

#include <cstring>

#include <iomanip>

#include <numeric>

#include <sstream>

#include <ctime>

#include <cctype>

#include <set>

#include <map>

#include <queue>

#include <bitset>

#include <deque>

#include <stack>

#include <memory.h>

using namespace std;

#define ll long long

int n,m;

vector<int> to;

bool ok[200010];

int main()

{

	memset(ok,0,sizeof(ok));

	cin>>n>>m;

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

		int x,y;

		cin>>x>>y;

		if(x==1&&y==n){

			cout<<"POSSIBLE";

			return 0;

		}

		if(x==1){

			ok[y]=1;

		}

		if(y==n){

			to.push_back(x);

		}

	}

	for(int i=0;i<to.size();i++){

		if(ok[to[i]]){

			cout<<"POSSIBLE";

			return 0;

		}

	}

	cout<<"IMPOSSIBLE";

    return 0;

}

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

#include<iostream>

#include<string.h>

#include<algorithm>

#include<map>

#include<vector>

#include<string>

#define ll long long

#define For(i,x,y)  for(ll i=x;i<=y;++i)

#define FOr(i,x,y)  for(ll i=x;i>=y;--i)

using namespace std;

inline ll read(){   ll x=0,f=1;char ch=getchar();   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}  return x*f; } 

inline void write(ll x){    if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10);   putchar(x%10+'0');  } 

inline void writeln(ll x){ write(x);   puts("");   }

const ll N=400010;

ll mark[N],gg[N],head[N],nxt[N],vet[N],m,n,tot;

int main(){

	n=read();	m=read();	mark[1]=1;

	For(i,1,m){

		ll x=read(),y=read();

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

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

		if (y==n&&mark[x])	return puts("POSSIBLE"),0;

		if (x==1&&gg[y])	return puts("POSSIBLE"),0;

	}puts("IMPOSSIBLE");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// skyrim belongs to the nords

#include<bits/stdc++.h>

#define mp make_pair

#define pb push_back 

#define sz(a) ((int)(a).size())

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

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

#define clr(a,v) memset(a, v, sizeof(a))

#define all(a) (a).begin(),(a).end() 

#define LOGN 18

#define EPS 1e-8

#define fcin ios_base::sync_with_stdio(false)

using namespace std;

typedef long long ll;

typedef double ld;

typedef pair<int,int> pii;

typedef vector<int> vi;



int d[200005], N, M;

vector<int> adj[200005];

vector<int> v;

bool pos = false; 

void dfs(int curr, int k) {

	if (pos) return;

	if (k == 0) {

		if (curr == N) pos = true;

		return;

	}

	// v.push_back(curr);

	for (auto &x: adj[curr]) {

		dfs(x, k - 1);

		if (pos) return;

	}

	// v.pop_back(); 

}

int main(){

	fcin;

	cin.tie(0);

 

	cin >> N >> M;

	int a, b;

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

		cin >> a >> b;

		adj[a].pb(b);

		adj[b].pb(a);

	} 

	dfs(1, 2);

	if (!pos) cout << "IMPOSSIBLE\n";

	else cout << "POSSIBLE\n";

}


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

#include<iostream>

#include<string.h>

#include<algorithm>

#include<map>

#include<vector>

#include<string>

#define ll long long

#define For(i,x,y)  for(ll i=x;i<=y;++i)

#define FOr(i,x,y)  for(ll i=x;i>=y;--i)

using namespace std;

inline ll read(){   ll x=0,f=1;char ch=getchar();   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}  return x*f; } 

inline void write(ll x){    if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10);   putchar(x%10+'0');  } 

inline void writeln(ll x){ write(x);   puts("");   }

const ll N=400010;

ll mark[N],gg[N],head[N],nxt[N],vet[N],m,n,tot;

int main(){

	n=read();	m=read();	mark[1]=1;

	For(i,1,m){

		ll x=read(),y=read();

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

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

		if (y==n&&mark[x])	return puts("POSSIBLE"),0;

		if (x==1&&gg[y])	return puts("POSSIBLE"),0;

	}puts("IMPOSSIBLE");

}

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

using namespace std;

queue<int>q;

int nedge=0,p[1000010],nex[1000010],head[1000010],rp[1000010];

int dist[200010],vis[200010],n,m,s,t,g,l;

inline void addedge(int x,int y){

	p[++nedge]=y;nex[nedge]=head[x];head[x]=nedge;

}

inline void spfa(){

	memset(dist,0x3f,sizeof dist);

	dist[1]=0;q.push(1);vis[1]=1;

	while(!q.empty()){

		int now=q.front();q.pop();

		for(int k=head[now];k;k=nex[k])if(dist[p[k]]>dist[now]+1){

			dist[p[k]]=dist[now]+1;

			if(!vis[p[k]]){vis[p[k]]=1;q.push(p[k]);}

		}vis[now]=0;

	}

}

int main()

{

	ios::sync_with_stdio(0);

	int n,m;cin>>n>>m;

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

		int x,y;cin>>x>>y;

		addedge(x,y);

	}

	spfa();

	if(dist[n]>2)puts("IMPOSSIBLE");

	else puts("POSSIBLE");

}

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

#define ll long long

#define ull unsigned long long

#define pii pair<int,int>

#define piii pair<int,pii>

#define pll pair<ll,ll>

#define plii pair<ll,pii>

#define vi vector<int>

#define ff first

#define ss second

#define mp make_pair

#define pb push_back

#define SORT(x) sort(x.begin(), x.end())

#define GSORT(x) sort(x.begin(), x.end(), greater<int>())

#define mx 100001

#define eps 0.00000000001

#define mod 1000000007

#define pi acos(-1)

#define inf 100000000

#define loop(i,b,n) for(int i=b;i<n;++i)

#define rev_loop(i,b,n) for(int i=b;i>=n;--i)

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main()

{

    fio;

    int n,m,x,y;

    cin>>n>>m;

    int a1[n+1]={0};

	int a2[n+1]={0};

	bool chk=false;

	loop(i,0,m){

		cin>>x>>y;

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

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

		if(a1[x] && a2[x])

            chk = true;

		if(a1[y] && a2[y])

		 chk =true;

	}

    if(chk)

    cout<<"POSSIBLE";

	else

	cout<<"IMPOSSIBLE";

    return 0;

}




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

#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define fr first

#define sc second

#define N 300009

#define inf 2e16

#define pi pair<ll,ll>

#define pb push_back

using namespace std;

typedef long long ll;

void slv()

{

}

vector<int>adj[N];

bool vis[N];

int dis[N];

void vfs(int s)

{

    queue<int>q;

    q.push(s);

    dis[s]=0;

    vis[s]=1;

    while (!q.empty())

    {

        int u=q.front();

        q.pop();

        for(auto v : adj[u])

        {

            if(!vis[v])

            {

                vis[v]=1;

                dis[v]=dis[u]+1;

                q.push(v);

            }

        }

    }

    

}

int main()

{

    int n,m;

    cin>>n>>m;

    while(m--)

    {

        int u,v;

        cin>>u>>v;

        adj[u].push_back(v);

        adj[v].push_back(u);

    }

    vfs(1);

    if(dis[n]==2) puts("POSSIBLE");

    else puts("IMPOSSIBLE");

    return 0;

}


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

#define ll long long

#define ull unsigned long long

#define pii pair<int,int>

#define piii pair<int,pii>

#define pll pair<ll,ll>

#define plii pair<ll,pii>

#define vi vector<int>

#define ff first

#define ss second

#define mp make_pair

#define pb push_back

#define SORT(x) sort(x.begin(), x.end())

#define GSORT(x) sort(x.begin(), x.end(), greater<int>())

#define mx 100001

#define eps 0.00000000001

#define mod 1000000007

#define pi acos(-1)

#define inf 100000000

#define loop(i,b,n) for(int i=b;i<n;++i)

#define rev_loop(i,b,n) for(int i=b;i>=n;--i)

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int main()

{

    fio;

    int n,m,x,y;

    cin>>n>>m;

    int a1[n+1]={0};

	int a2[n+1]={0};

	bool chk=false;

	loop(i,0,m){

		cin>>x>>y;

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

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

		if(a1[x] && a2[x])

            chk = true;

		if(a1[y] && a2[y])

		 chk =true;

	}

    if(chk)

    cout<<"POSSIBLE";

	else

	cout<<"IMPOSSIBLE";

    return 0;

}




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



using namespace std;

typedef long long ll;



vector<vector<int> > vec(200010, vector<int>());

int cnt[200010];



void s(int c, int to) {

  if (c > 2) {

    return;

  }

  cnt[to] = c;

  for(int i = 0; i < vec[to].size(); i++) {

    s(c + 1, vec[to][i]);

  }

}



int main() {

  int N, M;

  cin >> N >> M;



  int a, b;

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

    cin >> a >> b;

    vec[a].push_back(b);

  }



  s(0, 1);



  if (cnt[N] == 2) {

    cout << "POSSIBLE" << endl;

  } else {

    cout << "IMPOSSIBLE" << endl;

  }

  return 0;

}

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



using namespace std;

typedef long long ll;



int main() {

  int N, M;

  cin >> N >> M;



  bool from1[200000] = {}, to2[200000] = {};



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

    int a, b;

    cin >> a >> b;

    if (a == 1) {

      from1[b] = true;

    }

    if (b == N) {

      to2[a] = true;

    }

  }



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

    if (from1[i] && to2[i]) {

      cout << "POSSIBLE" << endl;

      return 0;

    }

  }

  cout << "IMPOSSIBLE" << endl;

  return 0;

}

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

using namespace std;



int s[200009];

int t[200009];



int main() {

    int n, m;

    cin >> n >> m;



    bool flag = false;

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

        int a, b;

        cin >> a >> b;

        if (a == 1) {

            s[b]++;

        }

        if (b == n) {

            t[a]++;

        }

    }



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

        if (s[i] && t[i]) {

            flag = true;

        }

    }



    if (flag) {

        puts("POSSIBLE");

    } else {

        puts("IMPOSSIBLE");

    }



    return 0;

}

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

using namespace std;



bool A[222222];

bool B[222222];



int main() {

   int N, M;

   cin >> N >> M;



   map<int, int> mp;

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

      int a, b;

      cin >> a >> b;

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

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

   }



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

      if (A[i] && B[i]) {

         puts("POSSIBLE");

         return 0;

      }

   }



   puts("IMPOSSIBLE");



   return 0;

}

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

using namespace std;



#include <bits/stdc++.h>

using namespace std;



struct edge { int to, cost; };

typedef pair<int, int> P; // firstは最短距離、secondは頂点の番号



const int VV = 222222;

const int INF = 1e8;

int V, M;

vector<edge> G[VV];

int d[VV];



void dijkstra(int s) {

   // 最短距離firstが小さい順に取り出せるようにする

   priority_queue<P, vector<P>, greater<P>> que;

   fill(d, d + V, INF); // 距離全てをINFで初期化

   d[s] = 0; // スタート地点を0で初期化

   que.push(P(0, s)); // キューに初期位置のコスト、初期位置をpush



   while (que.size()) {

      P p = que.top(); que.pop(); // p: 今の{最短距離、頂点番号}

      int v = p.second; // 今の頂点番号

      if (d[v] < p.first) continue; // 今見ている頂点の歴代最小距離 < 今見ている頂点の最短距離

      for (int i = 0; i < G[v].size(); i++) { // 今の頂点に隣接する頂点を調べる

         edge e = G[v][i];

         if (d[e.to] > d[v] + e.cost) { // 遷移先の頂点の歴代最小距離 > 今の距離 + 遷移コスト

            d[e.to] = d[v] + e.cost; // 歴代最小距離の更新

            que.push(P(d[e.to], e.to)); // 更新した遷移先の頂点をキューに突っ込む

         }

      }

   }

}



int main() {

   cin >> V >> M;

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

      int a, b;

      cin >> a >> b;

      a--, b--;

      G[a].push_back({b, 1});

      G[b].push_back({a, 1});

   }



   dijkstra(0);



   if (d[V-1] == 2) {

      puts("POSSIBLE");

   } else {

      puts("IMPOSSIBLE");

   }



   return 0;

}


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

using namespace std;



bool A[222222];

bool B[222222];



int main() {

   int N, M;

   cin >> N >> M;



   map<int, int> mp;

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

      int a, b;

      cin >> a >> b;

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

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

   }



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

      if (A[i] && B[i]) {

         puts("POSSIBLE");

         return 0;

      }

   }



   puts("IMPOSSIBLE");



   return 0;

}

// Fastest known solution for this problem: