stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using namespace std;

#define PI  3.14159265358979323846

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

#define rlp(i,n) for(int i = int(n);i >= 0;i--)

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

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

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

#define pb push_back

#define MP make_pair

#define fr first

#define sc second

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

#define sfi1(v) scanf("%d",&v)

#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)

#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)

#define sfll1(v) scanf("%I64d",&v);

#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)

#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)

typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<pair<int, int> > vii;

typedef pair<int, int> pii;

template<class T> using ordered_set=tree<T,

null_type,

less<T>,

rb_tree_tag,

tree_order_statistics_node_update>;

const ll MOD = 1e9 + 7;

const int OO = (int)1e6;

const int N = (int)200005;

int dx[] = {0,0,-1,1};

int dy[] = {1,-1,0,0};

void init(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}

int mult(int a,int b){

    int res = (a%MOD * b%MOD)%MOD;

    return res;

}

vector<int>adj[N];

int vis[N],vid, n,m;

bool f = false;

void dfs(int node,int cnt =0){

    vis[node]=1;

    

    if(node==n&&cnt==2){

        f = true;

        return;

    }else if(cnt==2){

        return ;

    }

    for(int child : adj[node]){

        if(!vis[child]){

            dfs(child,cnt+1);

        }

    }

}

void _run(){



  cin>>n>>m;

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

      int x,y;

      cin>>x>>y;

      adj[x].pb(y);

  }

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

      if(!vis[i]){

          dfs(i);

          if(f){

              puts("POSSIBLE");

              return ;

          }

      }

  }

  puts("IMPOSSIBLE");

}

int main() {

	#   ifdef LOCAL_PROJECT

        freopen("in.txt", "r", stdin);

    #   endif

    int t=1;

    // scanf("%d",&t);

    while(t--)_run();

    

    return 0;

}

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

using namespace std;



int main(){

    int n,m;

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

    vector<vector<int>> g(n);

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

        int a,b;

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

        --a,--b;

        g[a].push_back(b);

        g[b].push_back(a);

    }

    int dist[n];

    memset(dist,-1,sizeof(dist));

    queue<int> q;

    q.push(0);

    dist[0] = 0;

    while(q.size()){

        int dad = q.front();

        q.pop();

        for(auto va:g[dad]){

            if(dist[va] == -1){

                dist[va] = dist[dad]+1;

                q.push(va);

            }

        }

    }

    if(dist[n-1] != -1 && dist[n-1] < 3)

        puts("POSSIBLE");

    else

        puts("IMPOSSIBLE");

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



#define N 200005

int a[N],b[N];

using namespace std;

int main(){

    int c,d,e,f;

    cin>>e>>f;

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

        cin>>c>>d;

        if(c==1) a[d]=1;

        if(d==e) b[c]=1;

    }

    for(int j=1;j<e;j++){

        if(a[j]==1&&b[j]==1){

            cout<<"POSSIBLE"<<endl;

            return 0;

        }   

    }

    cout<<"IMPOSSIBLE"<<endl;

    return 0;

}

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

int a[1000001],b[1000001];

int main()

{

    int n,m,i;

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

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

    {

        int st,ed;

        scanf("%d%d",&st,&ed);

        if(st==1)a[ed]=1;//记录第一次坐船的终点 

        if(ed==n)b[st]=1;//记录第二次坐船的起点 

    }

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

        if(a[i]&&b[i])//等价于a[i]==1&&b[1]==1 

        {

            printf("POSSIBLE\n");return 0;//若有，直接退出 

        }

    printf("IMPOSSIBLE\n");

    return 0;

}
// Slower C++ solution:
#ifdef LOCAL

#include <cstdio>

#include <vector>

#include <algorithm>

#include <iostream>

#include <cstring>

#include <set>

#else

#include <bits/stdc++.h>

#endif

using namespace std ;



typedef long long ll ;

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

#define _sort(arg) sort(begin(arg), end(arg))

#define MOD 1000000007

#define pb push_back

#define DEBUG(x) cout << #x << ": " << x << endl;



/*

__attribute__((constructor))

void initial()

{

	cin.tie(NULL);

	ios::sync_with_stdio(false);

}

*/



int main()

{

	cin.tie(NULL);

	ios::sync_with_stdio(false);



	int N, M;

	

	cin >> N >> M;

	set<int> start, end;



	rep(i, M)

	{

		int a, b;

		cin >> a >> b;



		if (a == 1)

		{

			start.insert(b);

		}

		else if (b == 1) 

		{

			start.insert(a);

		}



		if (a == N)

		{

			end.insert(b);

		}

		else if (b == N)

		{

			end.insert(a);

		}

	}



	set<int>::iterator it=start.begin();

	bool find_ = false;

	/*

	for(; it!=start.end(); it++)

	{

		cout<<*it<<endl;



	}

	cout << "sdf" <<endl;

	set<int>::iterator ite=end.begin();

	for(; ite!=end.end(); ite++)

	{

		cout << *ite << endl;

	}



	cout <<"sfag" <<(end.find(2) != end.end()) << endl;

	*/

	for(; it!=start.end(); it++)

	{

		//cout << *it << endl;

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

		{

			find_ = true;

			break;

		}



	}



	if (find_)

	{

		cout << "POSSIBLE" << endl;

	}

	else

	{

		cout << "IMPOSSIBLE" << endl;

	}



	

	return 0;

}


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

int a[1000001],b[1000001];

int main()

{

    int n,m,i;

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

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

    {

        int st,ed;

        scanf("%d%d",&st,&ed);

        if(st==1)a[ed]=1;//记录第一次坐船的终点 

        if(ed==n)b[st]=1;//记录第二次坐船的起点 

    }

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

        if(a[i]&&b[i])//等价于a[i]==1&&b[1]==1 

        {

            printf("POSSIBLE\n");return 0;//若有，直接退出 

        }

    printf("IMPOSSIBLE\n");

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



#define N 200005

int a[N],b[N];

using namespace std;

int main(){

    int c,d,e,f;

    cin>>e>>f;

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

        cin>>c>>d;

        if(c==1) a[d]=1;

        if(d==e) b[c]=1;

    }

    for(int j=1;j<e;j++){

        if(a[j]==1&&b[j]==1){

            cout<<"POSSIBLE"<<endl;

            return 0;

        }   

    }

    cout<<"IMPOSSIBLE"<<endl;

    return 0;

}

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

int a[200001],b[200001];

int main() {

	int n,m,i;

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

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

		int st,ed;

		scanf("%d%d",&st,&ed);

		if(st==1)a[ed]=1;

		if(ed==n)b[st]=1;

	}

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

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

			printf("POSSIBLE\n");

			return 0;

		}

	printf("IMPOSSIBLE\n");

	return 0;

}
// Slower C++ solution:
#ifdef LOCAL

#include <cstdio>

#include <vector>

#include <algorithm>

#include <iostream>

#include <cstring>

#include <set>

#else

#include <bits/stdc++.h>

#endif

using namespace std ;



typedef long long ll ;

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

#define _sort(arg) sort(begin(arg), end(arg))

#define MOD 1000000007

#define pb push_back

#define DEBUG(x) cout << #x << ": " << x << endl;



/*

__attribute__((constructor))

void initial()

{

	cin.tie(NULL);

	ios::sync_with_stdio(false);

}

*/



int main()

{

	cin.tie(NULL);

	ios::sync_with_stdio(false);



	int N, M;

	

	cin >> N >> M;

	set<int> start, end;



	rep(i, M)

	{

		int a, b;

		cin >> a >> b;



		if (a == 1)

		{

			start.insert(b);

		}

		else if (b == 1) 

		{

			start.insert(a);

		}



		if (a == N)

		{

			end.insert(b);

		}

		else if (b == N)

		{

			end.insert(a);

		}

	}



	set<int>::iterator it=start.begin();

	bool find_ = false;

	/*

	for(; it!=start.end(); it++)

	{

		cout<<*it<<endl;



	}

	cout << "sdf" <<endl;

	set<int>::iterator ite=end.begin();

	for(; ite!=end.end(); ite++)

	{

		cout << *ite << endl;

	}



	cout <<"sfag" <<(end.find(2) != end.end()) << endl;

	*/

	for(; it!=start.end(); it++)

	{

		//cout << *it << endl;

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

		{

			find_ = true;

			break;

		}



	}



	if (find_)

	{

		cout << "POSSIBLE" << endl;

	}

	else

	{

		cout << "IMPOSSIBLE" << endl;

	}



	

	return 0;

}


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

int a[200001],b[200001];

int main() {

	int n,m,i;

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

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

		int st,ed;

		scanf("%d%d",&st,&ed);

		if(st==1)a[ed]=1;

		if(ed==n)b[st]=1;

	}

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

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

			printf("POSSIBLE\n");

			return 0;

		}

	printf("IMPOSSIBLE\n");

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int f[200005];

int main()

{

    int n,m;

    cin >> n >> m;

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

    {

        int a,b;

        cin >> a >> b;

        if(a == 1&&b == n){cout << "POSSIBLE";return 0;}

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

        if(b == n)f[a]+=300000;

    }

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

    {

        if(f[i]>=300000&&f[i]%300000>0){cout << "POSSIBLE";return 0;}

    }

    cout << "IMPOSSIBLE";

    return 0;

}






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

int a[200001],b[200001];

int main() {

	int n,m,i;

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

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

		int st,ed;

		scanf("%d%d",&st,&ed);

		if(st==1)a[ed]=1;

		if(ed==n)b[st]=1;

	}

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

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

			printf("POSSIBLE\n");

			return 0;

		}

	printf("IMPOSSIBLE\n");

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main() {

  int n, m;

  cin >> n >> m;

  vector<int> a(200002, 0), b(200002, 0);

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

    int c, d;

    cin >> c >> d;

    if(c == 1) a.at(d) = 1;

    if(d == n) b.at(c) = 1;

  }

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

    if(a.at(i) + b.at(i) == 2){

      cout << "POSSIBLE";

      return 0;

    }

  }

  cout << "IMPOSSIBLE";

}


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

using namespace std;



int main() {

  int n, m;

  cin >> n >> m;

  vector<int> a(200002, 0);

  string out = "IMPOSSIBLE";

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

    int c, d;

    cin >> c >> d;

    if(c == 1) a.at(d)++;

    if(d == n) a.at(c)++;

    if(a.at(d) == 2){

      out = "POSSIBLE";

    }

    if(a.at(c) == 2){

      out = "POSSIBLE";

    }

  }

  cout << out;

}
// Slower C++ solution:
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;



const int INF = 1e9;

const int MOD = 1e9+7;

const ll LINF = 1e18;



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

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

#define REPR(i,n) for(int i=n;i>=0;i--)

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

#define COUT(x) cout<<(x)<<endl



int main(){

    int n,m;

    cin >> n >> m;

    bool ant[200010]={};

    bool ball[200010]={};

    REP(i,m){

        int a,b;

        cin >> a >> b;

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

        if(b==n) ball[a]=true;

    }

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

        if(ant[i]&&ball[i]){

            COUT("POSSIBLE");

            return 0;

        }

    }

    COUT("IMPOSSIBLE");

    return 0;

}  


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

typedef long long ll;

using namespace std;



const int INF = 1e9;

const int MOD = 1e9+7;

const ll LINF = 1e18;



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

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

#define REPR(i,n) for(int i=n;i>=0;i--)

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

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



int gool[200010];



int main(){

    int n,m;

    cin >> n >> m;

    vector<int> a(m);

    vector<int> b(m);

    bool flag = false;

    

    REP(i,m)cin >> a[i] >> b[i];

    REP(i,m)if(a[i]==1)gool[b[i]]++;

    REP(i,m)if(gool[a[i]]>=1&&b[i]==n)flag = true;

    

    if(flag)COUT("POSSIBLE");

    else COUT("IMPOSSIBLE");

    return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

using namespace std;

vector<int> G[200005];

int n,m,a,b;

bool flag,f[200005];

void dfs(int now,int add) {

	if(flag)

		return;

	if(add == 2) {

		if(now == n)

			flag = true;

		return;

	}

	for(int i = 0; i < G[now].size(); ++i) {

		if(!f[G[now][i]]) {

			f[G[now][i]] = true;

			dfs(G[now][i],add + 1);

			f[G[now][i]] = false;

		}

	}

}

int main() {

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

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

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

		G[a].push_back(b);

		G[b].push_back(a);

	}	

	f[1] = true;

	dfs(1,0);

	if(flag)

		printf("POSSIBLE");

	else

		printf("IMPOSSIBLE");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.5543640702383086x):
using namespace std;

#include <bits/stdc++.h>

const int N = 2e5+5;

struct Edge{

    int to;

    int next;

}edge[N];

int n,m;

int tot,head[N];

void addEdge(int from,int to){

    edge[++tot].to=to;

    edge[tot].next=head[from];

    head[from]=tot;

}

bool dfs(int s,int step){

    if (s == n&&step == 2) return true;

    for(int i=head[s];i!=-1;i=edge[i].next){

        int to=edge[i].to;

        if (dfs(to,step+1)) return true;

    }

    return false;

}

int main() {

    memset(head,-1,sizeof(head));

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

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

        int x,y;

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

        addEdge(x,y);

    }

    bool flag=dfs(1,0);

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

    else printf("IMPOSSIBLE\n");

    return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

using namespace std;

vector<int> G[200005];

int n,m,a,b;

bool flag,f[200005];

void dfs(int now,int add) {

	if(flag)

		return;

	if(add == 2) {

		if(now == n)

			flag = true;

		return;

	}

	for(int i = 0; i < G[now].size(); ++i) {

		if(!f[G[now][i]]) {

			f[G[now][i]] = true;

			dfs(G[now][i],add + 1);

			f[G[now][i]] = false;

		}

	}

}

int main() {

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

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

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

		G[a].push_back(b);

		G[b].push_back(a);

	}	

	f[1] = true;

	dfs(1,0);

	if(flag)

		printf("POSSIBLE");

	else

		printf("IMPOSSIBLE");

	return 0;

}

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

#include<iostream>

int a[1000010],b[1000010];

int n,m;

int c,d;

int main()

{

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

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

    {

        scanf("%d%d",&c,&d);

        if(c==1)a[d]=1;

        if(d==n)b[c]=1;

    }

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

        if(a[i]==1&&b[i]==1)

        {

            printf("POSSIBLE\n");

            return 0;

        }

    printf("IMPOSSIBLE\n");

    return 0;

}
// Slower C++ solution:
using namespace std;

#include <bits/stdc++.h>

const int N = 2e5+5;

struct Edge{

    int to;

    int next;

}edge[N];

int n,m;

int tot,head[N];

void addEdge(int from,int to){

    edge[++tot].to=to;

    edge[tot].next=head[from];

    head[from]=tot;

}

bool dfs(int s,int step){

    if (s == n&&step == 2) return true;

    for(int i=head[s];i!=-1;i=edge[i].next){

        int to=edge[i].to;

        if (dfs(to,step+1)) return true;

    }

    return false;

}

int main() {

    memset(head,-1,sizeof(head));

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

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

        int x,y;

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

        addEdge(x,y);

    }

    bool flag=dfs(1,0);

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

    else printf("IMPOSSIBLE\n");

    return 0;

}


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

#include<iostream>

int a[1000010],b[1000010];

int n,m;

int c,d;

int main()

{

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

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

    {

        scanf("%d%d",&c,&d);

        if(c==1)a[d]=1;

        if(d==n)b[c]=1;

    }

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

        if(a[i]==1&&b[i]==1)

        {

            printf("POSSIBLE\n");

            return 0;

        }

    printf("IMPOSSIBLE\n");

    return 0;

}
// Slower C++ solution:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

#define INF (1<<30)

#define INFLL (1ll<<60)

typedef pair<ll, ll> P;

#define MOD (1000000007ll)

#define l_ength size



vector<int> g[225816];



int main(void){

	int n,m,i,j,a,b;

	bool flag = false;

	cin >> n >> m;

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

		cin >> a >> b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	for(i=(g[1].l_ength()-1); i>=0; --i){

		a = g[1][i];

		for(j=(g[a].size()-1); j>=0; --j){

			if(g[a][j] == n){

				flag = true;

				break;

			}

		}

		if(flag){

			break;

		}

	}

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

	return 0;

}


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

using namespace std;

typedef long long ll;

#define INF (1<<30)

#define INFLL (1ll<<60)

typedef pair<ll, ll> P;

#define MOD (1000000007ll)

#define l_ength size



int main(void){

	int n,m,i,a,b;

	bool fro[225816], ton[225816], flag = false;

	fill(fro,fro+225816,false);

	fill(ton,ton+225816,false);

	cin >> n >> m;

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

		cin >> a >> b;

		if(a == 1){

			fro[b] = true;

		}else if(b == n){

			ton[a] = true;

		}

	}

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

		if(fro[i] && ton[i]){

			cout << "POSSIBLE" << endl;

			flag = true;

			break;

		}

	}

	if(!flag){

		cout << "IMPOSSIBLE" << endl;

	}

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

#include <algorithm>

#include <cmath>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>

#include <bitset>

#include <iostream>



using namespace std;

typedef long long ll;

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

#define INF 2147483600

const int V=200010;

using P=pair<int,int>;

vector<P> G[V];

int dist[V];

bool used[V];

void dijkstra(int s){

  fill_n(dist,V,INF);

  fill_n(used,V,false);

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

  q.push(P(0,s));

  while(!q.empty()){

    int d; int t;

    tie(d,t)=q.top();q.pop();

    if(used[t])continue;

    used[t]=true;dist[t]=d;

    for(P e: G[t]){

      if(dist[e.second]<=d+e.first)continue;

      q.push(P(d+e.first,e.second));

    }

  }

}



inline ll read(){

  ll ans=0,c=getchar_unlocked();

  while(c<'0'||c>'9')c=getchar_unlocked();

  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar_unlocked();}

  return ans;

}

int main(){

  ll n,m,a,b;

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

  rep(i,m){

    a=read();b=read();

    G[a].emplace_back(1,b);

    G[b].emplace_back(1,a);

  }

  dijkstra(1);

  if(dist[n]<=2){

    printf("POSSIBLE\n");

  }else{

    printf("IMPOSSIBLE\n");

  }

  return 0;

}

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

bool A[200001],B[200001];

inline int read(){

  int ans=0,c=getchar_unlocked();

  while(c<'0'||c>'9')c=getchar_unlocked();

  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar_unlocked();}

  return ans;

}

int main(){

  int n,m,a,b;n=read();m=read();

  while(m--){a=read();b=read();

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

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

  }

  for(int i=1;i<=n;i++)if(A[i]&&B[i])return puts("POSSIBLE"),0;

  puts("IMPOSSIBLE");

  return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

#include <algorithm>

#include <cmath>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>

#include <bitset>

#include <iostream>



using namespace std;

typedef long long ll;

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

#define INF 2147483600

const int V=200010;

using P=pair<int,int>;

vector<P> G[V];

int dist[V];

bool used[V];

void dijkstra(int s){

  fill_n(dist,V,INF);

  fill_n(used,V,false);

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

  q.push(P(0,s));

  while(!q.empty()){

    int d; int t;

    tie(d,t)=q.top();q.pop();

    if(used[t])continue;

    used[t]=true;dist[t]=d;

    for(P e: G[t]){

      if(dist[e.second]<=d+e.first)continue;

      q.push(P(d+e.first,e.second));

    }

  }

}



inline ll read(){

  ll ans=0,c=getchar_unlocked();

  while(c<'0'||c>'9')c=getchar_unlocked();

  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar_unlocked();}

  return ans;

}

int main(){

  ll n,m,a,b;

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

  rep(i,m){

    a=read();b=read();

    G[a].emplace_back(1,b);

    G[b].emplace_back(1,a);

  }

  dijkstra(1);

  if(dist[n]<=2){

    printf("POSSIBLE\n");

  }else{

    printf("IMPOSSIBLE\n");

  }

  return 0;

}

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

#include <map>

inline int read(){

  int ans=0,c=getchar_unlocked();

  while(c<'0'||c>'9')c=getchar_unlocked();

  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar_unlocked();}

  return ans;

}

int main(){

  int n,m,a,b;n=read();m=read();

  std::map<int,bool> mp;

  while(m--){a=read();b=read();

    if(a==1){

      if(mp[b]==true)return puts("POSSIBLE"),0;

      mp[b]=true;

    }

    if(b==n){

      if(mp[a]==true)return puts("POSSIBLE"),0;

      mp[a]=true;

    }

  }

  puts("IMPOSSIBLE");

  return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

#include <algorithm>

#include <cmath>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>

#include <bitset>

#include <iostream>



using namespace std;

typedef long long ll;

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

#define INF 2147483600

const int V=200010;

using P=pair<int,int>;

vector<P> G[V];

int dist[V];

bool used[V];

void dijkstra(int s){

  fill_n(dist,V,INF);

  fill_n(used,V,false);

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

  q.push(P(0,s));

  while(!q.empty()){

    int d; int t;

    tie(d,t)=q.top();q.pop();

    if(used[t])continue;

    used[t]=true;dist[t]=d;

    for(P e: G[t]){

      if(dist[e.second]<=d+e.first)continue;

      q.push(P(d+e.first,e.second));

    }

  }

}



inline ll read(){

  ll ans=0,c=getchar_unlocked();

  while(c<'0'||c>'9')c=getchar_unlocked();

  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar_unlocked();}

  return ans;

}

int main(){

  ll n,m,a,b;

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

  rep(i,m){

    a=read();b=read();

    G[a].emplace_back(1,b);

    G[b].emplace_back(1,a);

  }

  dijkstra(1);

  if(dist[n]<=2){

    printf("POSSIBLE\n");

  }else{

    printf("IMPOSSIBLE\n");

  }

  return 0;

}

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

bool A[200001];inline int r(){int a=0,c=getchar_unlocked();while(c<48||c>57)c=getchar_unlocked();while(c>=48&&c<=57){a=a*10+(c-48);c=getchar_unlocked();}return a;}

main(){int n,m,a,b;n=r();m=r();while(m--){a=r();b=r();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");}
// Slower C++ solution:
#include <cstdio>

#include <map>

inline int read(){

  int ans=0,c=getchar_unlocked();

  while(c<'0'||c>'9')c=getchar_unlocked();

  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar_unlocked();}

  return ans;

}

int main(){

  int n,m,a,b;n=read();m=read();

  std::map<int,bool> mp;

  while(m--){a=read();b=read();

    if(a==1){

      if(mp[b]==true)return puts("POSSIBLE"),0;

      mp[b]=true;

    }

    if(b==n){

      if(mp[a]==true)return puts("POSSIBLE"),0;

      mp[a]=true;

    }

  }

  puts("IMPOSSIBLE");

  return 0;

}

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

bool A[200001];inline int r(){int a=0,c=getchar_unlocked();while(c<48||c>57)c=getchar_unlocked();while(c>=48&&c<=57){a=a*10+(c-48);c=getchar_unlocked();}return a;}

main(){int n,m,a,b;n=r();m=r();while(m--){a=r();b=r();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");}