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



using namespace std;



#define ll long long

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

#define endl '\n'

#define Endl '\n'

#define cont continue

#define gcd(a,b) __gcd(a,b)

#define lcm(a,b) a*b/__gcd(a,b)

#define pb push_back

#define mp make_pair

#define mem(x) memset(x, 0, sizeof(x))



const ll inf=1e18;

const int mod=1e9+7;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

const int mxn = 2e5+10;

vector<int>adj[mxn];



	

	

int main(){

    fast;



    int tt = 1;

    //cin>>tt;

    for(int tc = 1; tc <= tt; tc++) {

        int n,m;

        cin>>n>>m;

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

			int x,y;

			cin>>x>>y;

			//adj[x].pb(y);

			adj[y].pb(x);

		}

		for(int x : adj[n]) {

			sort(adj[x].begin(),adj[x].end());

			if(binary_search(adj[x].begin(),adj[x].end(),1)) return cout<<"POSSIBLE\n",0;

		}

        cout<<"IMPOSSIBLE\n";

        

    }







return 0;

}


// Optimized solution to the same problem (faster):
#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;

}

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

using namespace std;

int main()

{

    long long m,n,i,j,x,y,z,a[300000],k=0,cnt=0,b[300000];

    cin>>n>>m;

    memset(a,0,sizeof(a));

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

    {

        cin>>x>>y;

        a[x]=y;

        if(x==1)

        {

            b[k]=y;

            k++;

        }

    }

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

    {

        if(a[b[i]]==n)

        {

            cnt=1;

            break;

        }

    }

    if(cnt==1)

        cout<<"POSSIBLE"<<endl;

    else

        cout<<"IMPOSSIBLE"<<endl;





}


// Optimized solution to the same problem (faster):
#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;

}

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

using namespace std;

#define lli long long int

#define pii pair<int,int>

#define pll pair<lli,lli>

#define vi  vector<int>

#define vii vector<pair<int,int>>

#define vll vector<lli>

#define pb  push_back

#define mp  make_pair

#define ss  second

#define ff  first

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

const lli mod = 1e9+7;

//#ifndef ONLINE_JUDGE

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

//    freopen("output.txt", "w", stdout);

//    #endif

lli p2(lli n){lli ans=0;while(n>=1){n=n/2;ans++;}return ans;}

lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}

lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}

lli add(lli a,lli b){return(a+b)%mod;}

lli mul(lli a,lli b){return (a*b)%mod;}

lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}

lli lcm(lli a,lli b)

{

    lli ans=(a*b)/(__gcd(a,b));

    return ans;

}

int n,m;

vi adj[200001];

int vis[200001];

bool f;

void dfs(int curr,int c=0)

{

    vis[curr]=1;

    if(curr==n){f=true;return;}

    if(c==2)return;

    for(int i:adj[curr])

    {

        if(vis[i]==0)dfs(i,c+1);

    }



}

int main()

{

    cin>>n>>m;

    while(m--)

    {

        int a,b;cin>>a>>b;

        adj[a].pb(b);

        adj[b].pb(a);

    }

    dfs(1);

    if(f)cout<<"POSSIBLE\n";

    else cout<<"IMPOSSIBLE\n";

}








// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}






// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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";

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}  


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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");}

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

using namespace std;

/* typedef */

typedef long long ll;

typedef pair<int, int> pii;

/* constant */

const int INF = 1 << 30;

const ll LINF = 1LL << 50;

const int NIL = -1;

const int MAX = 200005;

const int mod = 1000000007;

const double pi = 3.141592653589;

/* global variables */

vector<vector<int> > G(MAX, vector<int>());

int N, M;

/* function */

void bfs() {

    vector<int> visited(MAX, -1);



    visited[0] = 0;

    queue<int> q;

    q.push(0);

    while (!q.empty()) {

        int from = q.front();

        q.pop();

        if (visited[from] >= 2) continue;

        for (int to : G[from]) {

            if (visited[to] != NIL) continue;

            visited[to] = visited[from] + 1;

            q.push(to);

        }

    }



    cout << ((visited[N-1] == 1 || visited[N-1] == 2) ? "POSSIBLE" : "IMPOSSIBLE") << '\n';

}

/* main */

int main(){

    cin >> N >> M;

    int a, b;

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

        cin >> a >> b;

        a--, b--;

        G[a].push_back(b);

        G[b].push_back(a);

    }



    bfs();

}


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

using namespace std;

/* typedef */

typedef long long ll;

typedef pair<int, int> pii;

/* constant */

const int INF = 1 << 30;

const ll LINF = 1LL << 50;

const int NIL = -1;

const int MAX = 10000;

const int mod = 1000000007;

const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */

int main(){

    int N, M;

    cin >> N >> M;

    vector<int> fromSt(N+1), toEnd(N+1);

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

        int a, b;

        cin >> a >> b;

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

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

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

    }

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

        if (fromSt[i] && toEnd[i]) {

            cout << "POSSIBLE" << '\n';

            return 0;

        }

    }

    cout << "IMPOSSIBLE" << '\n';

}


// Fastest known solution for this problem: