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

}

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

using namespace std;

typedef long long ll;

const int MAXSIZE=30000020;

int bufpos;

char buf[MAXSIZE];

#define NEG 0

void init(){

	#ifdef LOCAL

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

	#endif

	buf[fread(buf,1,MAXSIZE,stdin)]='\0';

	bufpos=0;

}

#if NEG

int readint(){

	bool isneg;

	int val=0;

	for(;!isdigit(buf[bufpos]) && buf[bufpos]!='-';bufpos++);

	bufpos+=(isneg=buf[bufpos]=='-');

	for(;isdigit(buf[bufpos]);bufpos++)

		val=val*10+buf[bufpos]-'0';

	return isneg?-val:val;

}

#else

int readint(){

	int val=0;

	for(;!isdigit(buf[bufpos]);bufpos++);

	for(;isdigit(buf[bufpos]);bufpos++)

		val=val*10+buf[bufpos]-'0';

	return val;

}

#endif

char readchar(){

	for(;isspace(buf[bufpos]);bufpos++);

	return buf[bufpos++];

}

int readstr(char* s){

	int cur=0;

	for(;isspace(buf[bufpos]);bufpos++);

	for(;!isspace(buf[bufpos]);bufpos++)

		s[cur++]=buf[bufpos];

	s[cur]='\0';

	return cur;

}

bool x[200002],y[200002];

int main(){

	init();

	int n=readint(),m=readint();

	while(m--){

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

		if (a==1)

			x[b]=true;

		if (b==n)

			y[a]=true;

	}

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

		if (x[i] && y[i]){

			return puts("POSSIBLE"),0;

		}

	puts("IMPOSSIBLE");

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

}


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

using namespace std;

typedef long long ll;

const int MAXSIZE=30000020;

int bufpos;

char buf[MAXSIZE];

#define NEG 0

void init(){

	#ifdef LOCAL

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

	#endif

	buf[fread(buf,1,MAXSIZE,stdin)]='\0';

	bufpos=0;

}

#if NEG

int readint(){

	bool isneg;

	int val=0;

	for(;!isdigit(buf[bufpos]) && buf[bufpos]!='-';bufpos++);

	bufpos+=(isneg=buf[bufpos]=='-');

	for(;isdigit(buf[bufpos]);bufpos++)

		val=val*10+buf[bufpos]-'0';

	return isneg?-val:val;

}

#else

int readint(){

	int val=0;

	for(;!isdigit(buf[bufpos]);bufpos++);

	for(;isdigit(buf[bufpos]);bufpos++)

		val=val*10+buf[bufpos]-'0';

	return val;

}

#endif

char readchar(){

	for(;isspace(buf[bufpos]);bufpos++);

	return buf[bufpos++];

}

int readstr(char* s){

	int cur=0;

	for(;isspace(buf[bufpos]);bufpos++);

	for(;!isspace(buf[bufpos]);bufpos++)

		s[cur++]=buf[bufpos];

	s[cur]='\0';

	return cur;

}

bool x[200002],y[200002];

int main(){

	init();

	int n=readint(),m=readint();

	while(m--){

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

		if (a==1)

			x[b]=true;

		if (b==n)

			y[a]=true;

	}

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

		if (x[i] && y[i]){

			return puts("POSSIBLE"),0;

		}

	puts("IMPOSSIBLE");

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

}

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

using namespace std;

const int N=200005;

int n,m,a[N],f[N],x,y;

int main()

{

	cin>>n>>m;

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

	{

		cin>>x>>y;

		if (x>y)

			swap(x,y);

		if (x==1)

			a[y]=1;

		if (y==n)

			f[x]=1;

	}

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

		if (a[i]&&f[i])

		{

			puts("POSSIBLE");

			return 0;

		}

	puts("IMPOSSIBLE");

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

}


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

using namespace std;

const int N=200005;

int n,m,a[N],f[N],x,y;

int main()

{

	cin>>n>>m;

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

	{

		cin>>x>>y;

		if (x>y)

			swap(x,y);

		if (x==1)

			a[y]=1;

		if (y==n)

			f[x]=1;

	}

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

		if (a[i]&&f[i])

		{

			puts("POSSIBLE");

			return 0;

		}

	puts("IMPOSSIBLE");

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

}

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

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

}


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

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

}

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

using namespace std;

const int N = 200005;

bool s[N], t[N];

int main()

{

	ios::sync_with_stdio(false);

	int n, m;

	cin >> n >> m;

	while (m--)

	{

		int u, v;

		cin >> u >> v;

		if (u == 1)

			s[v] = true;

		if (v == n)

			t[u] = true;

	}

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

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

		{

			cout << "POSSIBLE\n";

			return 0;

		}

	cout << "IMPOSSIBLE\n";

	return 0;

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

}


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

using namespace std;

const int N = 200005;

bool s[N], t[N];

int main()

{

	ios::sync_with_stdio(false);

	int n, m;

	cin >> n >> m;

	while (m--)

	{

		int u, v;

		cin >> u >> v;

		if (u == 1)

			s[v] = true;

		if (v == n)

			t[u] = true;

	}

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

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

		{

			cout << "POSSIBLE\n";

			return 0;

		}

	cout << "IMPOSSIBLE\n";

	return 0;

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

}

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

#include <cstdlib>

#include <cmath>

#include <cstring>

#include <string>

#include <algorithm>

#include <iostream>

#include <iomanip>

#define For(i,j,k) for(int i=j;i<=k;i++)

#define Dow(i,j,k) for(int i=j;i>=k;i--)

#define LL long long

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-48 ; ch = getchar() ; }

	return x * f ;

}



const int N = 2e5+11;

int n,m;

int vis_1[N],vis_2[N];





int main() {

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

	vis_1[1]=1; vis_2[n]=1;

	For(i, 1, m) {

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

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

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

	}

	For(i, 1, n) 

		if(vis_1[i] && vis_2[i]) {

			puts("POSSIBLE");

			return 0;

		}

	puts("IMPOSSIBLE");

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

}


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

#include <cstdlib>

#include <cmath>

#include <cstring>

#include <string>

#include <algorithm>

#include <iostream>

#include <iomanip>

#define For(i,j,k) for(int i=j;i<=k;i++)

#define Dow(i,j,k) for(int i=j;i>=k;i--)

#define LL long long

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-48 ; ch = getchar() ; }

	return x * f ;

}



const int N = 2e5+11;

int n,m;

int vis_1[N],vis_2[N];





int main() {

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

	vis_1[1]=1; vis_2[n]=1;

	For(i, 1, m) {

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

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

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

	}

	For(i, 1, n) 

		if(vis_1[i] && vis_2[i]) {

			puts("POSSIBLE");

			return 0;

		}

	puts("IMPOSSIBLE");

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

}


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

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

}

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

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

#define INF 1<<30

#define LINF 1LL<<60



bool dfs(int u,int t,int dep,vector<vector<int>>& G){

    if(dep == 2)return false;

    for(auto next: G[u]){

        if(next == t)return true;

        if(dfs(next,t,dep+1,G)){

            return true;

        }

    }

    return false;

}

int main(void) {

    cin.tie(0); ios::sync_with_stdio(false);

    int N,M; cin >> N >> M;

    vector<vector<int>> G(N);

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

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

        a--; b--;

        G[a].push_back(b);

        G[b].push_back(a);

    }

    if(dfs(0,N-1,0,G)){

        cout << "POSSIBLE" << endl;

    }else{

        cout << "IMPOSSIBLE" << endl;

    }

    return 0;

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

}


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

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

#define INF 1<<30

#define LINF 1LL<<60



bool dfs(int u,int t,int dep,vector<vector<int>>& G){

    if(dep == 2)return false;

    for(auto next: G[u]){

        if(next == t)return true;

        if(dfs(next,t,dep+1,G)){

            return true;

        }

    }

    return false;

}

int main(void) {

    cin.tie(0); ios::sync_with_stdio(false);

    int N,M; cin >> N >> M;

    vector<vector<int>> G(N);

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

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

        a--; b--;

        G[a].push_back(b);

        G[b].push_back(a);

    }

    if(dfs(0,N-1,0,G)){

        cout << "POSSIBLE" << endl;

    }else{

        cout << "IMPOSSIBLE" << endl;

    }

    return 0;

}