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

using namespace std;

long long vis[200005],dis[200005];

vector<long long>adj[200005];

void bfs(long long node)

{

    queue<long long>q;

    q.push(node);

    vis[node]=1;

    dis[node]=0;

    while(!q.empty())

    {

        long long c=q.front();

        q.pop();

        for(auto j:adj[c])

        {

            if(!vis[j])

            {

                q.push(j);

                dis[j]=dis[c]+1;

                vis[j]=1;

            }

        }

    }

}

int main()

{

    long long T,i,j,n,m,a,b;



        cin>>n>>m;

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

        {

            cin>>a>>b;

            adj[a].push_back(b);

            adj[b].push_back(a);

        }

        bfs(1);

        if(dis[n]==2)

            cout<<"POSSIBLE"<<endl;

        else

            cout<<"IMPOSSIBLE"<<endl;



}


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

using namespace std;



int main()

{

    long int n, m;

    cin >> n >> m;

    long int a, b, chk = 0;

    vector<long int>cnct_a;

    vector<long int>cnct_b;

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

        cin >> a >> b;

        if(a == 1 && b == n){

            chk = 1;

            break;

        }

        else{

            if(a == 1)

                cnct_a.push_back(b);

            if( b == n)

                cnct_b.push_back(a);

        }

    }

    sort(cnct_a.begin(), cnct_a.end());

    sort(cnct_b.begin(), cnct_b.end());



    if(chk == 0){

        if(cnct_a.size() == 0 || cnct_b.size() == 0)

            chk = 0;

        else{

            vector<long int>v(cnct_a.size() + cnct_b.size());

            vector<long int>::iterator it, st;

            it = set_intersection(cnct_a.begin(), cnct_a.end(), cnct_b.begin(), cnct_b.end(), v.begin());



            for (st = v.begin(); st != it; ++st){

                chk = 1;

                break;

            }

        }

    }

    if(chk == 0)

        cout << "IMPOSSIBLE";

    else if(chk == 1)

        cout << "POSSIBLE";



    return 0;

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

using namespace std;

#define int long long

typedef pair<int, int> ii;

typedef vector<int> vi;

typedef vector<ii> vii;

#define pb push_back

#define ld long double

#define f first

#define s second

#define in insert

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

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

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

const int INF = 1e18 + 5;

const int mod = 1e9 + 7;

const int  N = 2e5 + 314;

const long double pi = 3.1415926535897932384626433832795;

multiset<int>ms[N];

void solve(){

	int n, m;

	cin>>n>>m;

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

		int x, y;

		cin>>x>>y;

		ms[x].in(y);

	}

	for(auto i:ms[1]){

		auto it = *ms[i].lower_bound(n);

		if(it==n){

			cout<<"POSSIBLE";

			return;

		}

	}

	cout<<"IMPOSSIBLE";

}

signed main(){

	speed;

	int t=1;

	//cin>>t;

	while(t--)solve();

}

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

using namespace std;

typedef long long ll;

#define test int t; cin>>t; while(t--)

vector<int>arr[200001];

int vis[200001],di[200001];

void bfs(int root)

{



    queue<int> que;





    que.push(root);





    di[root] = 0;





    vis[root] = 1;





    while (!que.empty()) {





       root = que.front();

       que.pop();

        for (int i = 0; i < arr[root].size(); i++) {



            int b = arr[root][i];



            if (!vis[b]) {





                que.push(b);





                di[b] = di[root] + 1;





                vis[b] = 1;

            }

        }

    }

}















int main()

{

    int n,m,a,b;

    cin>>n>>m;

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

    {

        cin>>a>>b;

        arr[a].push_back(b);

        arr[b].push_back(a);



    }

    bfs(1);

    if(di[n]>2 || di[n]==0)

    {

        cout<<"IMPOSSIBLE"<<endl;

    }

    else cout<<"POSSIBLE"<<endl;



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

using namespace std;

#define int long long

typedef pair<int, int> ii;

typedef vector<int> vi;

typedef vector<ii> vii;

#define pb push_back

#define ld long double

#define f first

#define s second

#define in insert

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

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

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

const int INF = 1e18 + 5;

const int mod = 1e9 + 7;

const int  N = 2e5 + 314;

const long double pi = 3.1415926535897932384626433832795;

multiset<int>ms[N];

void solve(){

	int n, m;

	cin>>n>>m;

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

		int x, y;

		cin>>x>>y;

		ms[x].in(y);

	}

	for(auto i:ms[1]){

		auto it = *ms[i].lower_bound(n);

		if(it==n){

			cout<<"POSSIBLE";

			return;

		}

	}

	cout<<"IMPOSSIBLE";

}

signed main(){

	speed;

	int t=1;

	//cin>>t;

	while(t--)solve();

}

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

using namespace std;



#define LL long long

LL n,m, minx=1e9, maxx=0, miny=1e9, maxy=0;

int a,b;

bool valid=false;

bool connect1[300001];

bool connectn[300001];



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    

    cin>>n>>m;

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

        cin>>a>>b;

        if(a==1){

            connect1[b]=true;

        }

        if(b==n){

            connectn[a]=true;

        }

    }

    

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

        if(connect1[i] && connectn[i]){

            valid=true;

        }

    }

    if(valid){

        cout<<"POSSIBLE"<<endl;

    }else{

        cout<<"IMPOSSIBLE"<<endl;

    }

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

using namespace std;

long long vis[200005],dis[200005];

vector<long long>adj[200005];

void bfs(long long node)

{

    queue<long long>q;

    q.push(node);

    vis[node]=1;

    dis[node]=0;

    while(!q.empty())

    {

        long long c=q.front();

        q.pop();

        for(auto j:adj[c])

        {

            if(!vis[j])

            {

                q.push(j);

                dis[j]=dis[c]+1;

                vis[j]=1;

            }

        }

    }

}

int main()

{

    long long T,i,j,n,m,a,b;



        cin>>n>>m;

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

        {

            cin>>a>>b;

            adj[a].push_back(b);

            adj[b].push_back(a);

        }

        bfs(1);

        if(dis[n]==2)

            cout<<"POSSIBLE"<<endl;

        else

            cout<<"IMPOSSIBLE"<<endl;



}


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

using namespace std;



#define LL long long

LL n,m, minx=1e9, maxx=0, miny=1e9, maxy=0;

int a,b;

bool valid=false;

bool connect1[300001];

bool connectn[300001];



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    

    cin>>n>>m;

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

        cin>>a>>b;

        if(a==1){

            connect1[b]=true;

        }

        if(b==n){

            connectn[a]=true;

        }

    }

    

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

        if(connect1[i] && connectn[i]){

            valid=true;

        }

    }

    if(valid){

        cout<<"POSSIBLE"<<endl;

    }else{

        cout<<"IMPOSSIBLE"<<endl;

    }

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

using namespace std;

typedef long long ll;

#define test int t; cin>>t; while(t--)

vector<int>arr[200001];

int vis[200001],di[200001];

void bfs(int root)

{



    queue<int> que;





    que.push(root);





    di[root] = 0;





    vis[root] = 1;





    while (!que.empty()) {





       root = que.front();

       que.pop();

        for (int i = 0; i < arr[root].size(); i++) {



            int b = arr[root][i];



            if (!vis[b]) {





                que.push(b);





                di[b] = di[root] + 1;





                vis[b] = 1;

            }

        }

    }

}















int main()

{

    int n,m,a,b;

    cin>>n>>m;

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

    {

        cin>>a>>b;

        arr[a].push_back(b);

        arr[b].push_back(a);



    }

    bfs(1);

    if(di[n]>2 || di[n]==0)

    {

        cout<<"IMPOSSIBLE"<<endl;

    }

    else cout<<"POSSIBLE"<<endl;



}


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

using namespace std;



#define LL long long

LL n,m, minx=1e9, maxx=0, miny=1e9, maxy=0;

int a,b;

bool valid=false;

bool connect1[300001];

bool connectn[300001];



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    

    cin>>n>>m;

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

        cin>>a>>b;

        if(a==1){

            connect1[b]=true;

        }

        if(b==n){

            connectn[a]=true;

        }

    }

    

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

        if(connect1[i] && connectn[i]){

            valid=true;

        }

    }

    if(valid){

        cout<<"POSSIBLE"<<endl;

    }else{

        cout<<"IMPOSSIBLE"<<endl;

    }

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

using namespace std;

using ll = long long;



const int MAX_N = 2e5;



// 辺を保持

// いろんな保持の仕方がある

vector<int> ecasdqina[MAX_N];

/*

ほかにも

bool graph[MAX_N][MAX_N];

graph[a][b] := aとbの間に辺があるか?

といった定義にもできるけど,今回はMAX_Nが大きいのでMLE

(静的なのでコンパイル時に落ちる, これが割と気づきにくい)



vector< vector<int> > graph(MAX_N, vector<int>(MAX_N, 0));

と動的配列で書いても同様に実行時にMLE!!

動的配列を使うように心がけ解くと, MLEに気付きやすいかもという利点はある



さらに発展的な話題で,辺に重みがあったりする場合もこの二通りの

表現方法があるってことは頭の片隅にでも!(わからなかったらまた聞いてね!)

*/



// 僕はよく答えが二通りの問題とかは関数にしてるけど

// いいかどうかは人それぞれなので

int solve(int n) {

  vector<int> flag(n, 0);

  // 頂点1から行ける辺にマークを付ける(フラグを建てる)

  // ちなみにvector<bool>は特殊だからvector<int>を代わりに使う

  // 詳しくは調べてね

  // もちろんvector<bool>でもbool[MAX_N]でもいいよ

  

  // 拡張for (というのはJava的で, range-based for loopっていうのかな)

  // O(M) // なぜなら, 辺の数はたかだかM個だから, ecasdqina.size()はM程度

  for(int j : ecasdqina[0]) {

    // 頂点jに頂点1から行けるので印をつける

    flag[j] = 1; // trueでもよし

  }



  // 0-indexedなので頂点Nは[n-1]だよ

  // 上記と同様にO(M)

  for(int j : ecasdqina[n - 1]) {

    // 印がついてれば 1 - j - N というつながりがある！

    if(flag[j]) return 1; // true を返してもいい

  }

  // さてここまで来たらそんな辺はなかった

  return 0;

}



int main() {

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

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

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

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

    a--; b--;

    // push_back は emplace_back

    // 詳しくは調べてね

    ecasdqina[a].emplace_back(b);

    // 双方向につなぐことに注意してね

    ecasdqina[b].emplace_back(a);

  }

  // 例えばecasdqina[0]は配列になっているけど, 

  // それらは頂点1から行ける場所



  cout << (solve(n) ? "POSSIBLE" : "IMPOSSIBLE") << endl;

}




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

using namespace std;

using ll = long long;



int main() {

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

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

  vector<int> ecasdqina(n);

  while(m--) {

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

    if(a == 1 || a == n) ecasdqina[b-1]++;

    if(b == 1 || b == n) ecasdqina[a-1]++;

    if(ecasdqina[a-1] >=2 || ecasdqina[b-1] >= 2) {

      cout << "POSSIBLE" << endl;

      return 0;

    }

  }

  cout << "IMPOSSIBLE" << endl;

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

using namespace std;



int main(void)

{

    int N,M;

    cin >> N >> M;

    int a;

    int b;

    bool s[200010] = {false};

    bool t[200010] = {false};



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

        cin >> a >> b;

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

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

    }



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

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

            printf("POSSIBLE");

            return 0;

        }

    }

    printf("IMPOSSIBLE");

    

    return 0;

}

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

using namespace std;

#define ll long long int

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

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

#define REP(i,s,t) for( int i = s; i <= t; i++ )

#define RREP(i,s,t) for( int i = s; i >= t; i-- )

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF 2000000000

#define mod 1000000007

#define INF2 1000000000000000000





int main(void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

	int N, M;

	cin >> N >> M;

	int a[M], b[M];

	bool c[N + 1] = {};

	rep(i, M) cin >> a[i] >> b[i];

	rep(i, M) if (a[i] == 1) c[b[i]] = true;

	rep(i, M) if (b[i] == N && c[a[i]]) {

		cout << "POSSIBLE" << endl;

		return 0;

	}

	cout << "IMPOSSIBLE" << endl;



    return 0;

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

using namespace std;



int main(void)

{

    int N,M;

    cin >> N >> M;

    int a;

    int b;

    bool s[200010] = {false};

    bool t[200010] = {false};



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

        cin >> a >> b;

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

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

    }



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

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

            printf("POSSIBLE");

            return 0;

        }

    }

    printf("IMPOSSIBLE");

    

    return 0;

}

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

using namespace std;

#define ll long long int

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

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

#define REP(i,s,t) for( int i = s; i <= t; i++ )

#define RREP(i,s,t) for( int i = s; i >= t; i-- )

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF 2000000000

#define mod 1000000007

#define INF2 1000000000000000000



bool S[200010];

bool G[200010];

int main(void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int N, M;

    cin >> N >> M;

    rep(i, M) {

        int a, b;

        cin >> a >> b;

        a--; b--;

        if(a == 0) S[b] = true;

        if(b == N - 1) G[a] = true;

    }

    rep(i, N) {

        if(S[i] && G[i]) {

            cout << "POSSIBLE" << endl;

            return 0;

        }

    }

    cout << "IMPOSSIBLE" << endl;



    return 0;

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

using namespace std;



#define MAX_N 200000

#define MAX_M 200000



int N, M;

vector<int> ab[MAX_N + 1];



int main()

{

	cin >> N >> M;

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

		int a, b;

		cin >> a >> b;

		ab[a].push_back( b );

	}



	int ans = 0;

	for( int i = 0; i < ab[1].size(); i++ ) {

		int idx = ab[1][i];

		for( int j = 0; j < ab[idx].size(); j++ ) {

			if( ab[idx][j] == N ) {

				ans = 1;

				break;

			}

		}

	}



	if( ans == 1 ) {

		cout << "POSSIBLE" << endl;

	}

	else {

		cout << "IMPOSSIBLE" << endl;

	}



	return 0;

}


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

using namespace std;



int main()

{

	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 );

	}



	vector<int> v( N );

	typedef pair<int, int> P;

	queue<P> que;

	que.push( P( 0, 0 ) );

	v[0] = 1;

	string ans = "IMPOSSIBLE";

	while( !que.empty() ) {

		int d, x;

		tie( d, x ) = que.front();

		que.pop();

		if( x == N - 1 ) {

			ans = "POSSIBLE";

			break;

		}

		if( d >= 2 ) continue;

		for( int e : g[x] ) {

			if( v[e] ) continue;

			que.push( P( d + 1, e ) );

			v[e] = 1;

		}

	}



	cout << ans << endl;

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

#include<cstdio>

#include<algorithm>

using namespace std;

int a[100010];

int main ()

{

	int n,i;

	scanf("%d",&n);

	for(i=1;i<=n;++i) scanf("%d",&a[i]);

	sort(a+1,a+1+n);

	int stand1=a[n]/2,stand2;

	if(a[n]%2==0) stand2=stand1;

	else stand2=stand1+1;

	int p=1,minn=min(abs(stand1-a[1]),abs(stand2-a[1]));

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

	{

		int t=min(abs(stand1-a[i]),abs(stand2-a[i]));

		if(t<minn)

		{

			p=i;

			minn=t;

		}

	}

	printf("%d %d\n",a[n],a[p]);

} 

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

#include <math.h>

#include <algorithm>

using namespace std;

const int N = 100005;

int a[N];

double b[N];

int main()

{

	int n, maxa = -1;

	int ans;

	scanf("%d",&n);

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

		scanf("%d", &a[i]);

	sort(a + 1, a + 1 + n);

	double mid = 1.0 * a[n] / 2, minb = 1000000009.0;

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

	{

		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb)

		{

			ans = a[i];

			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));

		}

	}

	printf("%d %d\n", a[n], ans);

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

#define WR "txt"



void Open() { freopen(WR".in", "r", stdin); freopen(WR".out", "w", stdout); }

void Close() { fclose(stdin); fclose(stdout); }

using namespace std;

int Read()  {

	int val = 0, opt = 1; char ch;

	while (!isdigit(ch = getchar() )) if (ch == '-') opt = -1;

	while (isdigit( ch )) (val *= 10) += ch - '0', ch= getchar();

	return val * opt;

}



int a[100100], n, p;



void work()  {

	n = Read();

	for (int i = 1;i <= n; i++)	a[i] = Read();

	sort(a + 1, a + 1 + n);

	p = a[1];

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

		if (abs(a[i] - a[n] / 2.) < abs(p - a[n] / 2.)) p = a[i];

	printf("%d %d", a[n], p);

}



int main(void)  {

	//Open();

	work();

	//Close();

	return 0;

}

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

#include <math.h>

#include <algorithm>

using namespace std;

const int N = 100005;

int a[N];

double b[N];

int main()

{

	int n, maxa = -1;

	int ans;

	scanf("%d",&n);

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

		scanf("%d", &a[i]);

	sort(a + 1, a + 1 + n);

	double mid = 1.0 * a[n] / 2, minb = 1000000009.0;

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

	{

		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb)

		{

			ans = a[i];

			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));

		}

	}

	printf("%d %d\n", a[n], ans);

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

#include<algorithm>

#include<cmath>

bool cmp(int a, int b){

	return a > b;

}

using namespace std;

int main(){

	int n;

	long long mid = 0;

	long long a[100010];

	cin >> n;

	for(int i = 0; i < n; i ++)cin >> a[i];

	sort(a, a + n, cmp);

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

		if(abs(a[0] - 2 * a[i]) <= abs(a[0] - 2 * mid))mid = a[i];

		else break;

	}

	cout << a[0] << ' ' << mid; 

}

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

#include <math.h>

#include <algorithm>

using namespace std;

const int N = 100005;

int a[N];

double b[N];

int main()

{

	int n, maxa = -1;

	int ans;

	scanf("%d",&n);

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

		scanf("%d", &a[i]);

	sort(a + 1, a + 1 + n);

	double mid = 1.0 * a[n] / 2, minb = 1000000009.0;

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

	{

		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb)

		{

			ans = a[i];

			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));

		}

	}

	printf("%d %d\n", a[n], ans);

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

#include<algorithm>

#include<cstdlib>

#include<cstring>

#define ll long long

#define maxn 0x3f3f3f3f

using namespace std;

int a[100010];

int b[100010];

int main()

{

	int n;

	cin>>n;

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

	{

		scanf("%d",&a[i]);

	}

	sort(a+1,a+n+1);

	double k=a[n]*1.0;

	k = k/2.0;

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

	{

		b[i]=(a[i]-k<0?-(a[i]-k):a[i]-k);

	}

	int minn=0x3f3f3f3f,sum=0;

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

	{

		if(minn>b[i]){

			minn = b[i];

			sum = i;

		}

		

	}

	cout<<a[n]<<" "<<a[sum]<<endl;

}


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

#include <math.h>

#include <algorithm>

using namespace std;

const int N = 100005;

int a[N];

double b[N];

int main()

{

	int n, maxa = -1;

	int ans;

	scanf("%d",&n);

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

		scanf("%d", &a[i]);

	sort(a + 1, a + 1 + n);

	double mid = 1.0 * a[n] / 2, minb = 1000000009.0;

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

	{

		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb)

		{

			ans = a[i];

			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));

		}

	}

	printf("%d %d\n", a[n], ans);

}
// Slower C++ solution:
//D

#include<cstdio>

#include<iostream>

#include<algorithm>

using namespace std;

int a[100010];

bool cmp (int p,int b)

{

	return p>b;

}

int main()

{

	int n;

	int x,y1,y2,y,mid;

	scanf("%d",&n);

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

		scanf("%d",&a[i]);

	sort(a+1,a+1+n);//升序

	x=a[n];

	mid=x/2;

	y1=lower_bound(a+1,a+1+n,mid)-a;

	if(y1==n)

		y1=a[y1-1];

	else y1=a[y1];

	if(y1!=mid)

	{

		sort(a+1,a+1+n,cmp);//降序 

		y2=lower_bound(a+1,a+1+n,mid,greater<int>())-a;

		y2=a[y2];

	if((y1-1-mid)<(mid-y2))

		y=y1;

	else 

		y=y2;

	}

	if(y1==mid)

		y=y1;

	cout<<x<<" "<<y<<endl;

}

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

#include <math.h>

#include <algorithm>

using namespace std;

const int N = 100005;

int a[N];

double b[N];

int main()

{

	int n, maxa = -1;

	int ans;

	scanf("%d",&n);

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

		scanf("%d", &a[i]);

	sort(a + 1, a + 1 + n);

	double mid = 1.0 * a[n] / 2, minb = 1000000009.0;

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

	{

		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb)

		{

			ans = a[i];

			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));

		}

	}

	printf("%d %d\n", a[n], ans);

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

#include<iostream>

#include<cstring>

#include<cstdio>

#include<cmath>

using namespace std;

int f[100005];

int  maxx=-1,n,temp;

int main()

{

    cin>>n;

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

    {

    	scanf("%d",&f[i]);

    	if(f[i]>maxx)

		{

			maxx=f[i];

		

		}

	}

	if(n==2)

	{

		cout<<max(f[1],f[2])<<" "<<min(f[1],f[2])<<endl;

		return 0;

	}

		double mm=maxx/2.0;

		double minn=maxx;

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

	    {

	    	if(abs(f[i]-mm)<minn)

	    	{

	    	//	cout<<f[i]<<" "<<minn<<endl;

				minn=abs(f[i]-mm);

	    		temp=f[i];

			}

		}

		cout<<maxx<<" "<<temp;

		    return 0;

}

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

#include <math.h>

#include <algorithm>

using namespace std;

const int N = 100005;

int a[N];

double b[N];

int main()

{

	int n, maxa = -1;

	int ans;

	scanf("%d",&n);

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

		scanf("%d", &a[i]);

	sort(a + 1, a + 1 + n);

	double mid = 1.0 * a[n] / 2, minb = 1000000009.0;

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

	{

		if (fabs(mid - (1.0 * a[n] - 1.0 * a[i])) < minb)

		{

			ans = a[i];

			minb = fabs(mid - (1.0 * a[n] - 1.0 * a[i]));

		}

	}

	printf("%d %d\n", a[n], ans);

}