#define mm(a) memset(a,0,sizeof(a));
#define max(x,y) (x)>(y)?(x):(y)
#define min(x,y) (x)<(y)?(x):(y)
#define Fopen freopen("1.in","r",stdin); freopen("m.out","w",stdout);
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,b,a) for(int i=(b);i>=(a);i--)
#include<bits/stdc++.h>
typedef long long ll;
#define PII pair<ll,ll>
using namespace std;
const int INF=0x3f3f3f3f;
const int MAXN=(int)3e5 + 5;

int n,x,s;
vector<int>a,b,v;
vector<pair<int,int>>ans;
bool ck(int x,int mid,int op)
{
    if(op)cout<<"? "<<x<<" "<<1<<" "<<x<<" "<<mid<<endl;
    else cout<<"? "<<1<<" " <<x<<" "<<mid<<" "<<x<<endl;
    int now;
    cin>>now;
    return now&1;
}
void solve(int x,int op)//0->row 1->col
{
    int l=1,r=n,mid;
    while(l<r){
        mid=l+r>>1;
        if(ck(x,mid,op))r=mid;
        else l=mid+1;
    }
    if(op)ans.push_back(make_pair(x,l));
    else ans.push_back(make_pair(l,x));
}
int main()
{
    cin>>n;
    int temp=0;
    for(int i=1;i<n;i++){//row
        cout<<"? "<<i<<" "<<1<<" "<<i<<" "<<n<<endl;
        cin>>x;
        temp+=x&1;
        if(x&1)v.push_back(i);
    }
    if(temp==1)v.push_back(n);
    if(v.size()==2){
        solve(v[0],0);
        solve(v[1],0);
    }
    else {
        temp=0;
        for(int i=1;i<n;i++){//col
            cout<<"? "<<1<<" "<<i<<" "<<n<<" "<<i<<endl;
            cin>>x;
            temp+=x&1;
            if(x&1)v.push_back(i);
        }
        if(temp==1)v.push_back(n);
        solve(v[0],1);
        solve(v[1],1);
    }
    cout<<"! "<<ans[0].first<<" "<<ans[0].second<<" "<<ans[1].first<<" "<<ans[1].second<<endl;
    return 0;
}
/*

2
2
2 1
1 1

*/


#define mm(a) memset(a,0,sizeof(a));
#define max(x,y) (x)>(y)?(x):(y)
#define min(x,y) (x)<(y)?(x):(y)
#define Fopen freopen("1.in","r",stdin); freopen("m.out","w",stdout);
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,b,a) for(int i=(b);i>=(a);i--)
#include<bits/stdc++.h>
typedef long long ll;
#define PII pair<ll,ll>
using namespace std;
const int INF=0x3f3f3f3f;
const int MAXN=(int)3e5 + 5;

int n,x,s;
vector<int>a,b,v;
vector<pair<int,int>>ans;
bool ck(int x,int mid,int op) {
    if(op)cout<<"? "<<x<<" "<<1<<" "<<x<<" "<<mid<<endl;
    else cout<<"? "<<1<<" " <<x<<" "<<mid<<" "<<x<<endl;
    int now;
    cin>>now;
    if(now==-1)return 0;
    if(now&1)return 1;
    return 0;
}
void solve(int x,int op) { //0->row 1->col
    int l=1,r=n,mid;
    while(l<r) {
        mid=l+r>>1;
        if(ck(x,mid,op))r=mid;
        else l=mid+1;
    }
    if(op)ans.push_back(make_pair(x,l));
    else ans.push_back(make_pair(l,x));
}
int main() {
    cin>>n;
    int temp=0;
    for(int i=1; i<n; i++) { //row
        cout<<"? "<<1<<" "<<i<<" "<<n<<" "<<i<<endl;
        cin>>x;
        temp+=x&1;
        if(x&1)v.push_back(i);
    }
    if(temp&1)v.push_back(n);
    if(v.size()==2) {
        solve(v[0],0);
        solve(v[1],0);
    } else {
        temp=0;
        for(int i=1; i<n; i++) { //col
            cout<<"? "<<i<<" "<<1<<" "<<i<<" "<<n<<endl;
            cin>>x;
            temp+=x&1;
            if(x&1)v.push_back(i);
        }
        if(temp&1)v.push_back(n);
        solve(v[0],1);
        solve(v[1],1);
    }
    cout<<"! "<<ans[0].first<<" "<<ans[0].second<<" "<<ans[1].first<<" "<<ans[1].second<<endl;
    return 0;
}
/*

2
2
2 1
1 1

*/


#define mm(a) memset(a,0,sizeof(a));
#define max(x,y) (x)>(y)?(x):(y)
#define min(x,y) (x)<(y)?(x):(y)
#define Fopen freopen("1.in","r",stdin); freopen("m.out","w",stdout);
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,b,a) for(int i=(b);i>=(a);i--)
#include<bits/stdc++.h>
typedef long long ll;
#define PII pair<ll,ll>
using namespace std;
const int INF=0x3f3f3f3f;
const int MAXN=(int)3e5 + 5;

int n,x,s;
vector<int>a,b,v;
vector<pair<int,int>>ans;
bool ck(int x,int mid,int op)
{
    if(op)cout<<"? "<<x<<" "<<mid<<" "<<x<<" "<<mid<<endl;
    else cout<<"? "<<mid<<"" <<x<<" "<<mid<<" "<<x<<endl;
    int now;
    cin>>now;
    return now&1;
}
void solve(int x,int op)//0->row 1->col
{
    int l=1,r=n,mid;
    while(l<r){
        mid=l+r>>1;
        if(ck(x,mid,op))r=mid;
        else l=mid+1;
    }
    if(op)ans.push_back(make_pair(x,l));
    else ans.push_back(make_pair(l,x));
}
int main()
{
    cin>>n;
    int temp=0;
    for(int i=1;i<n;i++){//row
        cout<<"? "<<i<<" "<<1<<" "<<i<<" "<<n<<endl;
        cin>>x;
        temp+=x;
        if(x)v.push_back(i);
    }
    if(temp==1)v.push_back(n);
    if(v.size()==2){
        solve(v[0],0);
        solve(v[1],1);
    }
    else {
        temp=0;
        for(int i=1;i<n;i++){//col
            cout<<"? "<<1<<" "<<i<<" "<<1<<" "<<n<<endl;
            cin>>x;
            temp+=x;
            if(x)v.push_back(i);
        }
        if(temp==1)v.push_back(n);
        solve(v[0],1);
        solve(v[1],1);
    }
    cout<<"! "<<ans[0].first<<" "<<ans[0].second<<" "<<ans[1].first<<" "<<ans[1].second<<endl;
    return 0;
}


#define mm(a) memset(a,0,sizeof(a));
#define max(x,y) (x)>(y)?(x):(y)
#define min(x,y) (x)<(y)?(x):(y)
#define Fopen freopen("1.in","r",stdin); freopen("m.out","w",stdout);
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,b,a) for(int i=(b);i>=(a);i--)
#include<bits/stdc++.h>
typedef long long ll;
#define PII pair<ll,ll>
using namespace std;
const int INF=0x3f3f3f3f;
const int MAXN=(int)3e5 + 5;

int n,x,s;
vector<int>a,b,v;
vector<pair<int,int>>ans;
bool ck(int x,int mid,int op)
{
    if(op)cout<<"? "<<x<<" "<<mid<<" "<<x<<" "<<mid<<endl;
    else cout<<"? "<<mid<<"" <<x<<" "<<mid<<" "<<x<<endl;
    int now;
    cin>>now;
    return now&1;
}
void solve(int x,int op)//0->row 1->col
{
    int l=1,r=n,mid;
    while(l<r){
        mid=l+r>>1;
        if(ck(x,mid,op))r=mid;
        else l=mid+1;
    }
    if(op)ans.push_back(make_pair(x,l));
    else ans.push_back(make_pair(l,x));
}
int main()
{
    cin>>n;
    int temp=0;
    for(int i=1;i<n;i++){//row
        cout<<"? "<<i<<" "<<1<<" "<<i<<" "<<n<<endl;
        cin>>x;
        temp+=x;
        if(x)v.push_back(i);
    }
    if(temp==1)v.push_back(n);
    if(v.size()==2){
        solve(v[0],0);
        solve(v[1],1);
    }
    else {
        temp=0;
        for(int i=1;i<n;i++){//col
            cout<<"? "<<1<<" "<<i<<" "<<1<<" "<<n<<endl;
            cin>>x;
            temp+=x;
            if(x)v.push_back(i);
        }
        if(temp==1)v.push_back(n);
        solve(v[0],0);
        solve(v[1],1);
    }
    printf("%d %d %d %d\n",ans[0].first,ans[0].second,ans[1].first,ans[1].second);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair < int , int >
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back

const int X[4] = {0, 0, 1, -1};
const int Y[4] = {-1, 1, 0, 0};
const int N = 1e6 + 5;

inline int ask(int x, int y, int x1, int y1)
{
    cout << "? " << x << " " << y << " " << x1 << " " << y1 << endl;
    int res;
    cin >> res;
    return res;
}

int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(0);
//    cout.tie(0);

    #ifdef Estb_probitie
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    int n;
    cin >> n;
    vector < int > g, v;
    for (int i = 0; i < n; ++i)
    {
        int x = ask(i, 0, i, n - 1) % 2;
        if (x)
            g.pb(i);
    }
    for (int i = 0; i < n; ++i)
    {
        int x = ask(0, i, n - 1, i) % 2;
        if (x)
            v.pb(i);
    }

    if (!v.size())
    {
        for (auto gg : g)
        {
            int l = 0, r = n - 1;
            while (l < r)
            {
                int mid = (l + r) >> 1;
                if (ask(gg, 0, gg, mid) % 2 == 0)
                    l = mid + 1; else
                    r = mid;
            }
            v.pb(l);
        }
    }

    if (!g.size())
    {
        for (auto vv : v)
        {
            int l = 0, r = n - 1;
            while (l < r)
            {
                int mid = (l + r) >> 1;
                if (ask(0, vv, mid, vv) % 2 == 0)
                    l = mid + 1; else
                    r = mid;
            }
            g.pb(l);
        }
    }

    vector < pii > ans;
    if (g.size() < 2 || v.size() < 2)
        return 1;

    for (int i = 0; i < 2; ++i)
        for (int j = 0; j < 2; ++j)
            if (ask(g[i], v[j], g[i], v[j]) % 2)
                ans.pb({g[i], v[j]});
    cout << "! ";
    for (auto i : ans)
        cout << i.fi << " " << i.se << " ";
    cout << endl;

}


#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair < int , int >
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back

const int X[4] = {0, 0, 1, -1};
const int Y[4] = {-1, 1, 0, 0};
const int N = 1e6 + 5;

inline int ask(int x, int y, int x1, int y1)
{
    cout << "? " << x + 1 << " " << y + 1 << " " << x1 + 1 << " " << y1 + 1 << endl;
    int res;
    cin >> res;
    return res;
}

int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(0);
//    cout.tie(0);

//    #ifdef Estb_probitie
//        freopen("input.txt","r",stdin);
//        freopen("output.txt","w",stdout);
//    #endif

    int n;
    cin >> n;
    vector < int > g, v;
    for (int i = 0; i < n - 1; ++i)
    {
        int x = ask(i, 0, i, n - 1) % 2;
        if (x)
            g.pb(i);
    }
    for (int i = 0; i < n - 1; ++i)
    {
        int x = ask(0, i, n - 1, i) % 2;
        if (x)
            v.pb(i);
    }

    if (v.size() == 1)
        v.pb(n - 1);
    if (g.size() == 1)
        g.pb(n - 1);

    if (!v.size())
    {
        for (auto gg : g)
        {
            int l = 0, r = n - 1;
            while (l < r)
            {
                int mid = (l + r) >> 1;
                if (ask(gg, 0, gg, mid) % 2 == 0)
                    l = mid + 1; else
                    r = mid;
            }
            v.pb(l);
        }
    }

    if (!g.size())
    {
        for (auto vv : v)
        {
            int l = 0, r = n - 1;
            while (l < r)
            {
                int mid = (l + r) >> 1;
                if (ask(0, vv, mid, vv) % 2 == 0)
                    l = mid + 1; else
                    r = mid;
            }
            g.pb(l);
        }
    }
    if (v.size() > 1 && v[0] == v[1])
        v.pop_back();
    if (g.size() > 1 && g[0] == g[1])
        g.pop_back();

    vector < pii > ans;
    if (g.size() < 1 || v.size() < 1)
        return 1;

    for (int i = 0; i < g.size(); ++i)
        for (int j = 0; j < v.size(); ++j)
            if (ask(g[i], v[j], g[i], v[j]) % 2)
                ans.pb({g[i], v[j]});
    cout << "! ";
    for (auto i : ans)
        cout << i.fi + 1 << " " << i.se + 1 << " ";
    cout << endl;

}


#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair < int , int >
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back

const int X[4] = {0, 0, 1, -1};
const int Y[4] = {-1, 1, 0, 0};
const int N = 1e6 + 5;

inline int ask(int x, int y, int x1, int y1)
{
    cout << "? " << x + 1 << " " << y + 1 << " " << x1 + 1 << " " << y1 + 1 << endl;
    int res;
    cin >> res;
    return res;
}

int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(0);
//    cout.tie(0);

//    #ifdef Estb_probitie
//        freopen("input.txt","r",stdin);
//        freopen("output.txt","w",stdout);
//    #endif

    int n;
    cin >> n;
    vector < int > g, v;
    for (int i = 0; i < n; ++i)
    {
        int x = ask(i, 0, i, n - 1) % 2;
        if (x)
            g.pb(i);
    }
    for (int i = 0; i < n; ++i)
    {
        int x = ask(0, i, n - 1, i) % 2;
        if (x)
            v.pb(i);
    }

    if (!v.size())
    {
        for (auto gg : g)
        {
            int l = 0, r = n - 1;
            while (l < r)
            {
                int mid = (l + r) >> 1;
                if (ask(gg, 0, gg, mid) % 2 == 0)
                    l = mid + 1; else
                    r = mid;
            }
            v.pb(l);
        }
    }

    if (!g.size())
    {
        for (auto vv : v)
        {
            int l = 0, r = n - 1;
            while (l < r)
            {
                int mid = (l + r) >> 1;
                if (ask(0, vv, mid, vv) % 2 == 0)
                    l = mid + 1; else
                    r = mid;
            }
            g.pb(l);
        }
    }
    if (v.size() > 1 && v[0] == v[1])
        v.pop_back();
    if (g.size() > 1 && g[0] == g[1])
        g.pop_back();

    vector < pii > ans;
    if (g.size() < 1 || v.size() < 1)
        return 1;

    for (int i = 0; i < g.size(); ++i)
        for (int j = 0; j < v.size(); ++j)
            if (ask(g[i], v[j], g[i], v[j]) % 2)
                ans.pb({g[i], v[j]});
    cout << "! ";
    for (auto i : ans)
        cout << i.fi + 1 << " " << i.se + 1 << " ";
    cout << endl;

}


#include<bits/stdc++.h>
#define ff first
#define ss second
#define ret return
using namespace std;

int n;
int a[1005];

int main()
{
    cin>>n;
    for(int i = 0;i < n;i++)
        cin>>a[i];
    sort(a,a + n);
    cout<<( (a[n-1]) / 2) + 1;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{

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

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{

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

	       if(n%2==0)
	       {
	           if(a[0]<a[1])
	           cout<<a[0];
	           else
	           cout<<a[1];
	       }
	       else
	       {
	           if(a[0]>a[1])
	           cout<<a[0];
	           else
	           cout<<a[1];
	       }

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{

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

	       cout<<a[0];

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{

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

	       if(n%2==0)
	       {
	           if(a[0]<a[1])
	           cout<<a[0];
	           else
	           cout<<a[1];
	       }
	       else
	       {
	           if(a[0]>a[1])
	           cout<<a[0]
	           else
	           cout<<a[1];
	       }

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{

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

	       sort(a,a+n);

	       if(n%2==0)
	       cout<<a[(n/2)-1];
	       else
	       cout<<a[n/2];

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(n==1){
        cout<<0;
    }
    else if(n%2!=0){
        cout<<max(a[0],a[1]);
    }
    else{
        cout<<min(a[0],a[1]);
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<a[0];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(n%2!=0){
        cout<<a[0];
    }
    else{
        cout<<min(a[0],a[1]);
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(n==1){
        cout<<a[0];
    }
    else if(n%2!=0){
        cout<<max(a[0],a[1]);
    }
    else{
        cout<<min(a[0],a[1]);
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    /*for(int i=0;i<=n-1;i+=2){
        if(a[i]<a[i+1]){
            cout<<a[i+1];
            break;
        }
        else if(a[i]==a[i+1]){
            cout<<a[i];
            break;
        }
        else{
            cout<<a[i];
        }
    }*/
    if(n%2!=0){
        cout<<a[0];
    }
    else{
        cout<<a[1];
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);
    cout<<a[n-2];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==0){
        cout<<a[n/2-1];
    }
    else{
        cout<<a[n/2];
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(n%2!=0){
        cout<<max(a[0],a[1]);
    }
    else{
        cout<<min(a[0],a[1]);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n+1];
    for(int i=1;i<=n;i++)
    cin>>arr[i];

    sort(arr,arr+n);
    if(n%2==0)
    cout<<arr[n/2]<<endl;
    else
    cout<<arr[(n+1)/2]<<endl;

return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n+1];
    for(int i=1;i<=n;i++)
    cin>>arr[i];

    sort(arr,arr+n+1);
    if(n%2==0)
    cout<<arr[n/2]<<endl;
    else
    cout<<arr[(n+1)/2]<<endl;

return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];

    sort(arr,arr+n);
    if(n%2==0)
    cout<<arr[n/2-1]<<endl;
    else
    cout<<arr[(n+1)/2-1]<<endl;

return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=1;i<=n;i++)
    cin>>arr[i];

    sort(arr,arr+n);
    if(n%2==0)
    cout<<arr[n/2]<<endl;
    else
    cout<<arr[(n+1)/2]<<endl;

return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int temp;

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

    for(int i = 0; i < n; i++)
        for(int j = i +1; j < n; j++)
        {
            if(arr[i] > arr[j])
            {
                temp = arr[i];
                arr[i]=arr[j];
                arr[j] = temp;
            }
        }
    if( n&2 != 0)
    {
        cout << arr[(n-1)/2] << endl;
    }
    if(n&2 == 0)
    {
        cout << arr[n/2 +1] << endl;
    }

    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int temp;

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

    for(int i = 0; i < n; i++)
        for(int j = i +1; j < n; j++)
        {
            if(arr[i] < arr[j])
            {
                temp = arr[i];
                arr[i]=arr[j];
                arr[j] = temp;
            }
        }
    if( n&2 != 0)
    {
        cout << arr[n/2] << endl;
    }
    else
    {
        cout << arr[(n/2) -1] << endl;
    }

    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int temp;

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

    for(int i = 0; i < n; i++)
        for(int j = i +1; j < n; j++)
        {
            if(arr[i] < arr[j])
            {
                temp = arr[i];
                arr[i]=arr[j];
                arr[j] = temp;
            }
        }
    if( n&2 != 0)
    {
        cout << arr[(n-1)/2] << endl;
    }
    if(n&2 == 0)
    {
        cout << arr[n/2 +1] << endl;
    }

    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int temp;

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

    for(int i = 0; i < n; i++)
        for(int j = i +1; j < n; j++)
        {
            if(arr[i] < arr[j])
            {
                temp = arr[i];
                arr[i]=arr[j];
                arr[j] = temp;
            }
        }
    if( n&2 != 0)
    {
        cout << arr[n/2] << endl;
    }
    if(n&2 == 0)
    {
        cout << arr[n/2 -1] << endl;
    }

    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int temp;

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

    for(int i = 0; i < n; i++)
        for(int j = i +1; j < n; j++)
        {
            if(arr[i] > arr[j])
            {
                temp = arr[i];
                arr[i]=arr[j];
                arr[j] = temp;
            }
        }
    if( n&2 != 0)
        cout << arr[n/2] << endl;
    else
        cout << arr[n/2 -1] << endl;

    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int temp;

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

    for(int i = 0; i < n; i++)
        for(int j = i +1; j < n; j++)
        {
            if(arr[i] > arr[j])
            {
                temp = arr[i];
                arr[i]=arr[j];
                arr[j] = temp;
            }
        }
    if( n&2 != 0)
    {
        cout << arr[n/2] << endl;
    }
    else
    {
        cout << arr[(n/2) -1] << endl;
    }

    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    int temp;

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

    for(int i = 0; i < n; i++)
        for(int j = i +1; j < n; j++)
        {
            if(arr[i] > arr[j])
            {
                temp = arr[i];
                arr[i]=arr[j];
                arr[j] = temp;
            }
        }
    if( n&2 != 0)
    {
        cout << arr[n/2] << endl;
    }
    if(n&2 == 0)
    {
        cout << arr[n/2 -1] << endl;
    }

    return 0;
}


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=100;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
    cin>>n;
    for ( int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    /* (int i = 0; i < n; ++i)
    {
        cout<<a[i]<<" ";
    }*/
        if (n<=2)
    {

        cout<<a[0]<<"\n";
        return 0;
    }

    cout<<a[(n-1)/2]<<"\n";
    return 0;
}//4 23 37 38 60 67 81 82 86 96


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=100;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
    cin>>n;
    for ( int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    {

        cout<<a[0]<<"\n";
        return 0;
    }

    cout<<a[n/2]<<"\n";
    return 0;
}


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=105;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
cin>>n;
    for ( int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    if (n%2==0){

        n/=2;
        n--;
    }
    else
        {
            n--;
            n/=2;
        }
        cout<<a[n]<<"\n";
            return 0;
}//4 23 37 38 60 67 81 82 86 96


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=100;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
cin>>n;
    for ( int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n+1);
        if (n<=2)
    {

        cout<<a[0]<<"\n";
        return 0;
    }
    if (n%2==0)
        n/=2;
    else
        {
            n--;
            n/=2;
        }
        cout<<a[n+1]<<"\n";
            return 0;
}//4 23 37 38 60 67 81 82 86 96


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=1005;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
cin>>n;
    for ( int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    if (n%2==0){

        n/=2;
        n--;
    }
    else
        {
            n--;
            n/=2;
        }
        cout<<a[n]<<"\n";
            return 0;
}//4 23 37 38 60 67 81 82 86 96


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=100;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
    cin>>n;
    for ( int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n+1);
        if (n<=2)
    {

        cout<<a[0]<<"\n";
        return 0;
    }
    if (n%2==0)
        n/=2;
    else
        {
            n++;
            n/=2;
        }
    cout<<a[n]<<"\n";
    return 0;
}


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=100;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
cin>>n;
    for ( int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
        if (n<=2)
    {

        cout<<a[0]<<"\n";
        return 0;
    }
    if (n%2==0)
        n/=2;
    else
        {
            n--;
            n/=2;
        }
        cout<<a[n]<<"\n";
            return 0;
}//4 23 37 38 60 67 81 82 86 96


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=100;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
cin>>n;
    for ( int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
        if (n<=2)
    {

        cout<<a[0]<<"\n";
        return 0;
    }
    if (n%2==0){

        n/=2;
        n--;
    }
    else
        {
            n--;
            n/=2;
        }
        cout<<a[n]<<"\n";
            return 0;
}//4 23 37 38 60 67 81 82 86 96


#include <iostream>
#include<string>
#include<stdio.h>
#include<set>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std ;
typedef long long ll;
const int N=100;
int n,a[N];
int main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
    //**********    **********//
    cin>>n;
    for ( int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    cout<<a[n/2]<<"\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

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

	cout<<sum/n<<endl;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

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

	}
	sort(a,a+n);
	printf("%d\n",a[(n11)/2]);

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

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

	}
	sort(a,a+n);
	printf("%d\n",a[(n-1)/2]);

}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

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

		cin>>a[i];

	cout<<a[0]<<endl;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <utility>
#define ll long long int
using namespace std;
string s;
ll ar[211111];
int main() {
    int n;
    cin >> n;
    for(int i=0; i<n; cin >> ar[i],i++);
    sort(ar,ar+n);
    int i=-1, j=n;
    int cnt = 0;
    if(n==1)
        return 0 * printf("%lld\n",ar[0]);
    while(true){
        j--;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
        i++;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <utility>
#define ll long long int
using namespace std;
string s;
ll ar[211111];
int main() {
    int n;
    cin >> n;
    for(int i=0; i<n; cin >> ar[i],i++);
    sort(ar,ar+n);
    int i=-1, j=n;
    int cnt = 0;
    while(true){
        j--;
        cnt++;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
        i++;
        cnt++;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <utility>
#define ll long long int
using namespace std;
string s;
ll ar[211111];
int main() {
    int n;
    cin >> n;
    for(int i=0; i<n; cin >> ar[i],i++);
    sort(ar,ar+n);
    int i=n-1, j=0;
    int cnt = 0;
    while(true){
        j++;
        cnt++;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
        i--;
        cnt++;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <utility>
#define ll long long int
using namespace std;
string s;
ll ar[211111];
int main() {
    int n;
    cin >> n;
    for(int i=0; i<n; cin >> ar[i],i++);
    sort(ar,ar+n);
    int i=n-1, j=0;
    while(true){
        j++;
        if(i==j){
            cout << ar[i] << endl;
            return 0;
        }
        i--;
        if(i==j){
            cout << ar[i] << endl;
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <utility>
#define ll long long int
using namespace std;
string s;
ll ar[211111];
int main() {
    int n;
    cin >> n;
    for(int i=0; i<n; cin >> ar[i],i++);
    sort(ar,ar+n);
    int i=-1, j=n;
    int cnt = 0;
    while(true){
        j--;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
        i++;
        if(i==j || cnt==n-1){
            cout << ar[i] << endl;
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <time.h>
#define TheAxe  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
	TheAxe;
	int n, arr[10000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	for (int i = 0,j=n-1,c=0; i < n-1; i++) {
		if ((i + 1) % 2 == 0) {
			arr[j] = -1000;
			j--;
		}
		else {
			arr[c] = -1000;
			c++;
		}
	}
	for (int i = 0; i < n; i++) {
		if (arr[i] > 0)cout << arr[i]<<"\n";
	}
	system("pause");
	return 0;
}


#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <time.h>
#include <algorithm>
#define TheAxe  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
	TheAxe;
	int n, arr[10000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	for (int i = 0,j=n-1,c=0; i < n-1; i++) {
		if ((i + 1) % 2 == 0) {
			arr[j] = -1000;
			j--;
		}
		else {
			arr[c] = -1000;
			c++;
		}
	}
	for (int i = 0; i < n; i++) {
		if (arr[i] > 0)cout << arr[i]<<"\n";
	}
	return 0;
}


#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <time.h>
#define TheAxe  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
	int n, arr[10000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	cout << arr[(n - 1) / 2];
	return 0;
}


#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <time.h>
#define TheAxe  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
	int n, arr[10000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	cout << arr[(n - 1) / 2];
	return 0;
}


#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <time.h>
#define TheAxe  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
	TheAxe;
	int n, arr[10000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	cout << (n - 1) / 2;
	return 0;
}


#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <time.h>
#define TheAxe  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
	TheAxe;
	int n, arr[10000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	for (int i = 0,j=n-1,c=0; i < n-1; i++) {
		if ((i + 1) % 2 == 0) {
			arr[j] = -1000;
			j--;
		}
		else {
			arr[c] = -1000;
			c++;
		}
	}
	for (int i = 0; i < n; i++) {
		if (arr[i] > 0)cout << arr[i]<<"\n";
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
int main()
{
    int n;
    cin>>n;
    deque<long> d;
    long x;
    for(long i=0;i<n;i++)
    {
        cin>>x;
        d.push_back(x);
    }
    sort(d.begin(),d.end());
    while(d.size()!=1)
    {
        d.pop_front();
        d.pop_back();
        if(d.size()==1)
        {
            for(long i=0;i<d.size();i++)
            {
                cout<<d[i];
            }
        }
    }
}


#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
int main()
{
    int n;
    cin>>n;
    deque<long> d;
    long x;
    for(long i=0;i<n;i++)
    {
        cin>>x;
        d.push_back(x);
    }
    sort(d.begin(),d.end());
    if(n%2==0)
    {
        cout<<d[n/2-1];
    }
    else cout<<d[n/2];
}


#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
int main()
{
    int n;
    cin>>n;
    deque<long> d;
    long x;
    for(long i=0;i<n;i++)
    {
        cin>>x;
        d.push_back(x);
    }
    sort(d.begin(),d.end());
    if(n%2==0)
    {
        cout<<n/2-1;
    }
    else cout<<n/2;
}


#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
int main()
{
    int n;
    cin>>n;
    deque<long> d;
    long x;
    for(long i=0;i<n;i++)
    {
        cin>>x;
        d.push_back(x);
    }
    sort(d.begin(),d.end());
    while(d.size()!=1)
    {
        d.pop_front();
        if(d.size()==1)
        break;
        d.pop_back();
        if(d.size()==1)
        break;
    }
    for(int i=0;i<1;i++)
    cout<<d[i];
}


#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
int main()
{
    int n;
    cin>>n;
    deque<long> d;
    long x;
    for(long i=0;i<n;i++)
    {
        cin>>x;
        d.push_back(x);
    }
    sort(d.begin(),d.end());
     cout<<d[n/2];
}


#include<bits/stdc++.h>
using namespace std;

//Containers
typedef long long int lng;
#define vint vector<int>
#define vtwod vector<vector<int>>
#define vlng vector<long long int>
#define vstr vector<string>
#define vpint vector<pair<int,int>>
#define pint pair<int,int>
#define lint list<int>
#define qint queue<int>
#define dqint deque<int>
#define pq priority_queue<int>
#define rpq priority_queue<int,vector<int>,greater<int>>
#define fl forward_list<int>
#define st stack<int>
#define sint set<int>
#define msint multiset<int>

//Methods of containers:-
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define binsear binary_search
#define popf pop_front
#define popb pop_back
#define empb emplace_back
#define empf emplace_front
#define emp emplace
#define emt empty
#define ins insert
#define insaft insert_after
#define emplaft emplace_after
#define ersaft erase_after
#define swp swap
#define splicaft splice_after

//FUNCTIONS
bool isprime(int n)
{
    if(n<=1)
    {
        return false;
    }
    for(size_t i=2;i<n;i++)
    {
        if(n%i==0)
        {
            return false;
        }
    }
    return true;
}

int min3(int a,int b,int c)
{
    return min(min(a,b),c);
}

int max3(int a,int b,int c)
{
    return max(max(a,b),c);
}

void gcd(int a,int b)
{
    cout<<__gcd(a,b)<<endl;
}

/*******************************************************CODE**************************************************************/
void doit()
{
    int n=0;
    cin>>n;
    int a[n];
    for(size_t i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vint v(a,a+n);
    /*for(size_t i=0;i<=(n-1)/2;i++)
    {
        int maxi=*max_element(v.begin(),v.end());
        auto it1=find(v.begin(),v.end(),maxi);
        v.erase(it1);
        int mini=*min_element(v.begin(),v.end());
        auto it2=find(v.begin(),v.end(),mini);
        v.erase(it2);
    }*/
    //cout<<v[0]<<endl;
    sort(v.begin(),v.end());
    cout<<v[(n-1)/2]<<endl;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(NULL);
    doit();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

//Containers
typedef long long int lng;
#define vint vector<int>
#define vtwod vector<vector<int>>
#define vlng vector<long long int>
#define vstr vector<string>
#define vpint vector<pair<int,int>>
#define pint pair<int,int>
#define lint list<int>
#define qint queue<int>
#define dqint deque<int>
#define pq priority_queue<int>
#define rpq priority_queue<int,vector<int>,greater<int>>
#define fl forward_list<int>
#define st stack<int>
#define sint set<int>
#define msint multiset<int>

//Methods of containers:-
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define binsear binary_search
#define popf pop_front
#define popb pop_back
#define empb emplace_back
#define empf emplace_front
#define emp emplace
#define emt empty
#define ins insert
#define insaft insert_after
#define emplaft emplace_after
#define ersaft erase_after
#define swp swap
#define splicaft splice_after

//FUNCTIONS
bool isprime(int n)
{
    if(n<=1)
    {
        return false;
    }
    for(size_t i=2;i<n;i++)
    {
        if(n%i==0)
        {
            return false;
        }
    }
    return true;
}

int min3(int a,int b,int c)
{
    return min(min(a,b),c);
}

int max3(int a,int b,int c)
{
    return max(max(a,b),c);
}

void gcd(int a,int b)
{
    cout<<__gcd(a,b)<<endl;
}

/*******************************************************CODE**************************************************************/
void doit()
{
    int n=0;
    cin>>n;
    int a[n];
    for(size_t i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vint v(a,a+n);
    /*for(size_t i=0;i<=(n-1)/2;i++)
    {
        int maxi=*max_element(v.begin(),v.end());
        auto it1=find(v.begin(),v.end(),maxi);
        v.erase(it1);
        int mini=*min_element(v.begin(),v.end());
        auto it2=find(v.begin(),v.end(),mini);
        v.erase(it2);
    }*/
    //cout<<v[0]<<endl;
    sort(v.begin(),v.end());
    cout<<v((n-1)/2)<<endl;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(NULL);
    doit();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

//Containers
typedef long long int lng;
#define vint vector<int>
#define vtwod vector<vector<int>>
#define vlng vector<long long int>
#define vstr vector<string>
#define vpint vector<pair<int,int>>
#define pint pair<int,int>
#define lint list<int>
#define qint queue<int>
#define dqint deque<int>
#define pq priority_queue<int>
#define rpq priority_queue<int,vector<int>,greater<int>>
#define fl forward_list<int>
#define st stack<int>
#define sint set<int>
#define msint multiset<int>

//Methods of containers:-
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define binsear binary_search
#define popf pop_front
#define popb pop_back
#define empb emplace_back
#define empf emplace_front
#define emp emplace
#define emt empty
#define ins insert
#define insaft insert_after
#define emplaft emplace_after
#define ersaft erase_after
#define swp swap
#define splicaft splice_after

//FUNCTIONS
bool isprime(int n)
{
    if(n<=1)
    {
        return false;
    }
    for(size_t i=2;i<n;i++)
    {
        if(n%i==0)
        {
            return false;
        }
    }
    return true;
}

int min3(int a,int b,int c)
{
    return min(min(a,b),c);
}

int max3(int a,int b,int c)
{
    return max(max(a,b),c);
}

void gcd(int a,int b)
{
    cout<<__gcd(a,b)<<endl;
}

/*******************************************************CODE**************************************************************/
void doit()
{
    int n=0;
    cin>>n;
    int a[n];
    for(size_t i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vint v(a,a+n);
    for(size_t i=0;i<(n-1)/2;i++)
    {
        int maxi=*max_element(v.begin(),v.end());
        auto it1=find(v.begin(),v.end(),maxi);
        v.erase(it1);
        int mini=*min_element(v.begin(),v.end());
        auto it2=find(v.begin(),v.end(),mini);
        v.erase(it2);
    }
    cout<<v[0]<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(NULL);
    doit();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

//Containers
typedef long long int lng;
#define vint vector<int>
#define vtwod vector<vector<int>>
#define vlng vector<long long int>
#define vstr vector<string>
#define vpint vector<pair<int,int>>
#define pint pair<int,int>
#define lint list<int>
#define qint queue<int>
#define dqint deque<int>
#define pq priority_queue<int>
#define rpq priority_queue<int,vector<int>,greater<int>>
#define fl forward_list<int>
#define st stack<int>
#define sint set<int>
#define msint multiset<int>

//Methods of containers:-
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define binsear binary_search
#define popf pop_front
#define popb pop_back
#define empb emplace_back
#define empf emplace_front
#define emp emplace
#define emt empty
#define ins insert
#define insaft insert_after
#define emplaft emplace_after
#define ersaft erase_after
#define swp swap
#define splicaft splice_after

//FUNCTIONS
bool isprime(int n)
{
    if(n<=1)
    {
        return false;
    }
    for(size_t i=2;i<n;i++)
    {
        if(n%i==0)
        {
            return false;
        }
    }
    return true;
}

int min3(int a,int b,int c)
{
    return min(min(a,b),c);
}

int max3(int a,int b,int c)
{
    return max(max(a,b),c);
}

void gcd(int a,int b)
{
    cout<<__gcd(a,b)<<endl;
}

/*******************************************************CODE**************************************************************/
void doit()
{
    int n=0;
    cin>>n;
    int a[n];
    for(size_t i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vint v(a,a+n);
    for(size_t i=0;i<=(n-1)/2;i++)
    {
        int maxi=*max_element(v.begin(),v.end());
        auto it1=find(v.begin(),v.end(),maxi);
        v.erase(it1);
        int mini=*min_element(v.begin(),v.end());
        auto it2=find(v.begin(),v.end(),mini);
        v.erase(it2);
    }

    cout<<v[1]<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(NULL);
    doit();
    return 0;
}


#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
/*using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef double db;
typedef long long ll;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
typedef map < ll, ll > mll;
typedef set < ll > sll;
typedef vll lnum;

#define pb push_back
#define F first
#define S second
#define D(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll INF = LLONG_MAX;
const ll base = 1e9;
const db PI = acos(-1);
const ll MOD = 1e9 + 7;
const ll N = 5e6;

int prime[15000005], cnt[15000005];

void solve();
void sieve();*/
int main()
{
	int n;
	cin >> n;
	int a[n +1];
	for ( int i =1; i <= n; ++i)
	{
		cin >> a[i];
	}

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

	if(n % 2 == 0)
	cout << a[(n / 2)];
	else
	cout << a[n / 2 +1];

}


#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
/*using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef double db;
typedef long long ll;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
typedef map < ll, ll > mll;
typedef set < ll > sll;
typedef vll lnum;

#define pb push_back
#define F first
#define S second
#define D(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll INF = LLONG_MAX;
const ll base = 1e9;
const db PI = acos(-1);
const ll MOD = 1e9 + 7;
const ll N = 5e6;

int prime[15000005], cnt[15000005];

void solve();
void sieve();*/
int main()
{
	int n;
	cin >> n;
	int a[n +1];
	for ( int i =1; i <= n; ++i)
	{
		cin >> a[i];
	}

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

	if(n % 2 == 0)
	cout << a[(n / 2) + 1];
	else
	cout << a[n / 2];

}


#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
/*using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef double db;
typedef long long ll;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
typedef map < ll, ll > mll;
typedef set < ll > sll;
typedef vll lnum;

#define pb push_back
#define F first
#define S second
#define D(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll INF = LLONG_MAX;
const ll base = 1e9;
const db PI = acos(-1);
const ll MOD = 1e9 + 7;
const ll N = 5e6;

int prime[15000005], cnt[15000005];

void solve();
void sieve();*/
int main()
{
	int n;
	cin >> n;
	int a[n];
	for ( int i =0; i < n; ++i)
	{
		cin >> a[i];
	}

	sort (a, a + n);

	if(n % 2 == 0)
	cout << a[(n / 2) + 1];
	else
	cout << a[n / 2];

}


#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
/*using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef double db;
typedef long long ll;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
typedef map < ll, ll > mll;
typedef set < ll > sll;
typedef vll lnum;

#define pb push_back
#define F first
#define S second
#define D(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll INF = LLONG_MAX;
const ll base = 1e9;
const db PI = acos(-1);
const ll MOD = 1e9 + 7;
const ll N = 5e6;

int prime[15000005], cnt[15000005];

void solve();
void sieve();*/
int main()
{
	int n;
	cin >> n;
	int a[n +1];
	for ( int i =1; i <= n; ++i)
	{
		cin >> a[i];
	}

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

	if(n % 2 == 0)
	cout << a[((n / 2) + ((n / 2) + 1))/2 ];

	else
	cout << a[(n + 1)/ 2];

}


#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
/*using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef double db;
typedef long long ll;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
typedef map < ll, ll > mll;
typedef set < ll > sll;
typedef vll lnum;

#define pb push_back
#define F first
#define S second
#define D(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll INF = LLONG_MAX;
const ll base = 1e9;
const db PI = acos(-1);
const ll MOD = 1e9 + 7;
const ll N = 5e6;

int prime[15000005], cnt[15000005];

void solve();
void sieve();*/
int main()
{
	int n;
	cin >> n;
	int x = n +1;
	int a[x];

	for ( int i =1; i <= n; ++i)
	{
		cin >> a[i];
	}

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

	if(n % 2 == 0)
	cout << a[(n / 2)];
	else
	cout << a[n / 2 +1];

}


#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
/*using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef double db;
typedef long long ll;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
typedef map < ll, ll > mll;
typedef set < ll > sll;
typedef vll lnum;

#define pb push_back
#define F first
#define S second
#define D(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll INF = LLONG_MAX;
const ll base = 1e9;
const db PI = acos(-1);
const ll MOD = 1e9 + 7;
const ll N = 5e6;

int prime[15000005], cnt[15000005];

void solve();
void sieve();*/
int main()
{
	int n;
	cin >> n;
	int x = n +1;
	int a[x];

	for ( int i =1; i <= n; ++i)
	{
		cin >> a[i];
	}

	sort (a, a + x);

	if(n % 2 == 0)
	cout << a[(n / 2)];
	else
	cout << a[n / 2 +1];

}


#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/

using namespace std;
/*using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef double db;
typedef long long ll;
typedef pair < ll, ll > pll;
typedef vector < ll > vll;
typedef map < ll, ll > mll;
typedef set < ll > sll;
typedef vll lnum;

#define pb push_back
#define F first
#define S second
#define D(x) cout << (#x) << " is " << (x) << endl
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll INF = LLONG_MAX;
const ll base = 1e9;
const db PI = acos(-1);
const ll MOD = 1e9 + 7;
const ll N = 5e6;

int prime[15000005], cnt[15000005];

void solve();
void sieve();*/
int main()
{
	int n;
	cin >> n;
	int a[n +1];
	for ( int i =1; i <= n; ++i)
	{
		cin >> a[i];
	}

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

	if(n % 2 == 0)
	cout << a[((n / 2) + ((n / 2) + 1))/2 ];
	else
	cout << a[(n + 1)/ 2];

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int n,i;
    cin>>n;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==0)
    {
        cout<<a[n/2]<<endl;
    }
    else cout<<a[(n-1)/2]<<endl;

}


#include <iostream>

using namespace std;

int main()
{
    int n,i;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==0)
    {
        cout<<a[n/2]<<endl;
    }
    else cout<<a[(n-1)/2]<<endl;

}


#include <bits/stdc++.h>
int a[1000006];
using namespace std;

int main()
{
    long long int n,i;
    cin>>n;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==0)
    {
        cout<<a[n/2]<<endl;
    }
    else cout<<a[(n-1)/2]<<endl;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,i;
    cin>>n;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==0)
    {
        cout<<a[n/2]<<endl;
    }
    else cout<<a[(n+1)/2]<<endl;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,i;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==0)
    {
        cout<<a[n/2]<<endl;
    }
    else cout<<a[(n-1)/2]<<endl;

}


#include <bits/stdc++.h>
int a[1000006];
using namespace std;

int main()
{
    long long int n,i;
    cin>>n;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n,greater<int>());
    if(n%2==0)
    {
        cout<<a[n/2]<<endl;
    }
    else cout<<a[(n-1)/2]<<endl;

}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	if(n%2==1) cout<<a[n/2 + 1];
	else cout<<a[n/2];
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[1000];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<n;i++){
		int min=i;
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j]){
				int t=a[i];
				a[i]=a[j];
				a[j]=t;
				min=j;
			}
		}
	}
	if(n%2==1) cout<<a[(n/2)+1];
	else cout<<a[(n/2)];
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[1000];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	if(n==2){
		if(a[1]<a[2])cout<<a[1];
		else cout<<a[2];
	}
	else if(n%2==1) cout<<a[(n/2)+1];
	else cout<<a[(n/2)];
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[1000];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	if(n%2==1) cout<<a[(n/2)+1];
	else cout<<a[n/2];
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int a, b, c[1005], d;

int main() {

	cin>>a;
	for (int q=1; q<=a; q++){
		cin>>c[q];
	}
	sort(c+1, c+a+1);

	if (a%2==0) cout<<c[a/2];
	else cout<<c[((a/2)+1)];
}


#include <bits/stdc++.h>
using namespace std;

int a, b, c[105], d;

int main() {

	cin>>a;
	for (int q=1; q<=a; q++){
		cin>>c[q];
	}
	sort(c+1, c+a+1);

	if (a&2==0) cout<<c[a/2];
	else cout<<c[((a/2)+1];
}


#include <bits/stdc++.h>
using namespace std;

int a, b, c[105], d;

int main() {

	cin>>a;
	for (int q=1; q<=a; q++){
		cin>>c[q];
	}
	sort(c+1, c+a+1);

	if (a&2==0) cout<<c[a/2];
	else cout<<c[((a/2)+1)];
}


#include <bits/stdc++.h>
using namespace std;

int a, b, c[105], d;

int main() {

	cin>>a;
	for (int q=1; q<=a; q++){
		cin>>c[q];
	}
	sort(c+1, c+a+1);

	if (a&2==0) cout<<c[a/2];
	else cout<<c[((a+1)/2)];
}


#include <bits/stdc++.h>
using namespace std;

int a, b, c[105], d;

int main() {

	cin>>a;
	for (int q=1; q<=a; q++){
		cin>>c[q];
	}
	sort(c+1, c+a+1);

	if (a%2==0) cout<<c[a/2];
	else cout<<c[((a/2)+1)];
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,f,c,d;
    vector<int>b;
    cin>>n;

    for(c=1;c<=n;c++){
        cin>>d;
        b.push_back(d);
    }
    f=b[n-1];

    for(c=0;c<n-1;c++){
        if(c%2==0){
            f=f-b[c];
        }
        else{
            f=f+b[c];
        }
    }

    cout<<f<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,t,i,a[1001];
int main(){
    cin>>n;
    for (i=0; i<n; i++){
        cin>>a[i];
    }
    sort (a+1, a+n+1);
    t=(n+1)/2;
    cout<<a[t]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int n,t,i,a[1001];
int main(){
    cin>>n;
    for (i=0; i<n; i++){
        cin>>a[i];
    }
    sort (a, a+n);
    t=(n+1)/2;
    cout<<a[t]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int n,i,a[1001];
int main(){
    cin>>n;
    for (i=1; i<=n; i++){
        cin>>a[i];
    }
    sort(a,a+n);
    cout<<a[(n+1)/2]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int n,t,i,a[1000];
main(){
    cin>>n;
    for(i=0; i<n; i++){
        cin>>a[i];
    }
    sort(a,a+n);
    t=(n-1)/2
    cout<<a[t];
}


#include<bits/stdc++.h>
using namespace std;
int n,i,a[1001];
int main(){
    cin>>n;
    for (i=1; i<=n; i++){
        cin>>a[i];
    }
    sort(a,a+n);
    if (n%2==0){
        cout<<a[n/2]<<endl;
    }
    else
    if (n%2==1){
        cout<<a[n/2+1]<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int n,t,a[1001];
int main(){
    cin>>n;
    for (i=0; i<n; i++){
        cin>>a[i];
    }
    sort (a, a+n);
    t=(n+1)/2;
    cout<<a[t]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int n,t,i,a[1000];
main(){
    cin>>n;
    for(i=0; i<n; i++){
        cin>>a[i];
    }
    sort(a,a+n);
    t=(n-1)/2;
    cout<<a[t];
}


#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int A[n],i,temp,j;
    for(i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(i=0;i<n-1;i++){
        for(j=0;j<n-i-1;j++)
        {
            if(A[j]>A[j+1])
            {
                temp=A[j];
                A[j]=A[j+1];
                A[j+1]=temp;
            }
        }
    }
    if(n%2==0)
    {
        if(A[n/2]>A[n/2+1])
        cout<<A[n/2+1];
        else
        cout<<A[n/2];
    }
    else
    cout<<A[n/2];
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int A[n],i,temp,j;
    for(i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(i=0;i<n-1;i++){
        for(j=0;j<n-i-1;j++)
        {
            if(A[j]>A[j+1])
            {
                temp=A[j];
                A[j]=A[j+1];
                A[j+1]=temp;
            }
        }
    }
    if(n%2==0)
    {
        if(A[n/2]<A[n/2+1])
        cout<<A[n/2-1];
        else
        cout<<A[n/2];
    }
    else
    cout<<A[n/2];
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int A[n],i,temp,j;
    for(i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(i=0;i<n-1;i++){
        for(j=0;j<n-i-1;j++)
        {
            if(A[j]>A[j+1])
            {
                temp=A[j];
                A[j]=A[j+1];
                A[j+1]=temp;
            }
        }
    }
    if(n%2==0)
    {
        if(A[n/2]<A[n/2+1])
        cout<<A[n/2+1];
        else
        cout<<A[n/2];
    }
    else
    cout<<A[n/2];
    return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,a,b,d) for(int i=a; i<=b; i+=d)
#define repd(i,a,b,d) for(int i=a; i>=b; i-=d)
#define repi(it,stl) for(auto it = (stl).begin(); (it)!=stl.end(); ++(it))
#define sz(a) ((int)(a).size())
#define mem(a,n) memset((a), (n), sizeof(a))
#define all(n) (n).begin(),(n).end()
#define rall(n) (n).rbegin(),(n).rend()
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define sstr stringstream
#define indexof(v,x) (find(all((v)),(x))-(v).begin())

typedef long long ll;
using namespace std;

int clr[100005],cnt[100005];
vector<bitset<100005> > vis;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("main.txt","rt",stdin);
    //  freopen("out.txt","wt",stdout);
#endif

    int n,m;
    while(cin >> n >> m){
        vis.clear();
        vis.resize(n+3);
        mem(cnt,0);
        rep(i,n) cin >> clr[i];
        int a,b;
        rep(i,m){
            cin >> a >> b;
            --a,--b;
            a = clr[a], b = clr[b];
            if(a==b) continue;
            if(!vis[a][b]){
                vis[a][b]=1;
                cnt[a]++;
            }

            if(!vis[b][a]){
                vis[b][a]=1;
                cnt[b]++;
            }
        }
        cout << max_element(cnt,cnt+n+1)-cnt << "\n";

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

vector<int> G[100000];
set<int> C[100000];
int color[100000];
int V[100000];
void dfs(int u){
	V[u] = 1;
	for(int v : G[u])
		if(V[v] == 0){
			if(color[u] != color[v]){
				C[color[u]].insert(color[v]);
				C[color[v]].insert(color[u]);
			}
			dfs(v);
		}
}

int main(){
	int a,b,n , m,cmax = 0;
	scanf("%d %d",&n,&m);
	set<int> colors;
	for(int i = 0;i < n;i++){
		scanf("%d",&color[i]);
		colors.insert(color[i]);
		cmax = max(cmax,color[i]);
	}
	for(int i = 0;i < m;i++){
		scanf("%d %d",&a,&b);
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for(int i = 0;i < n;i++)
		if(V[i] == 0)
			dfs(0);

	int ans = *colors.begin();
	for(auto c : colors) {
		if(C[c].size() > C[ans].size())
			ans = c;
	}
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int color[100001],degree[100001];

int main(){
	int a,b,n,m,ans = 0;
	scanf("%d %d",&n,&m);
	for(int i = 1;i <= n;i++)
		scanf("%d",&color[i]);
	for(int i = 0;i < m;i++){
		scanf("%d %d",&a,&b);
		if(color[a] != color[b]){
			degree[color[a]]++;
			degree[color[b]]++;
			if(ans == -1) ans = color[a];
			if(degree[color[a]] > degree[color[b]]) ans = color[a];
			else ans = color[b];
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

vector<int> G[100000];
set<int> C[100000];
int color[100000];
int V[100000];
void dfs(int u){
	V[u] = 1;
	for(int v : G[u])
		if(V[v] == 0){
			if(color[u] != color[v]){
				C[color[u]].insert(color[v]);
				C[color[v]].insert(color[u]);
			}
			dfs(v);
		}
}

int main(){
	int a,b,n , m,cmax = 0;
	scanf("%d %d",&n,&m);
	for(int i = 0;i < n;i++){
		scanf("%d",&color[i]);
		cmax = max(cmax,color[i]);
	}
	for(int i = 0;i < m;i++){
		scanf("%d %d",&a,&b);
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(0);
	int ans = 0;
	for(int i = 1;i <= cmax;i++) {
		if(C[i].size() > C[ans].size())
			ans = i;
	}
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int color[100001],degree[100001];

int main(){
	int a,b,n,m,ans = 0;
	scanf("%d %d",&n,&m);
	set<int> C;
	for(int i = 1;i <= n;i++){
		scanf("%d",&color[i]);
		C.insert(color[i]);
	}
	for(int i = 0;i < m;i++){
		scanf("%d %d",&a,&b);
		if(color[a] != color[b]){
			degree[color[a]]++;
			degree[color[b]]++;
		}
	}
	ans = *C.begin();
	for(int c : C)
		if(degree[c] > degree[ans])
			ans = c;
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int color[100001];
set<int> neig[100001];

int main(){
	int a,b,n,m,ans = 0;
	scanf("%d %d",&n,&m);
	set<int> C;
	for(int i = 1;i <= n;i++){
		scanf("%d",&color[i]);
		C.insert(color[i]);
	}
	for(int i = 0;i < m;i++){
		scanf("%d %d",&a,&b);
		if(color[a] != color[b]){
			neig[color[a]].insert(color[b]);
			neig[color[b]].insert(color[a]);
		}
	}
	ans = *C.begin();
	for(int c : C)
		if(neig[c].size() > neig[ans].size())
			ans = c;
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

vector<int> G[100000];
set<int> C[100000];
int color[100000];
int V[100000];
void dfs(int u){
	V[u] = 1;
	for(int v : G[u])
		if(V[v] == 0){
			if(color[u] != color[v]){
				C[color[u]].insert(color[v]);
				C[color[v]].insert(color[u]);
			}
			dfs(v);
		}
}

int main(){
	int a,b,n , m,cmax = 0;
	scanf("%d %d",&n,&m);
	set<int> colors;
	for(int i = 0;i < n;i++){
		scanf("%d",&color[i]);
		colors.insert(color[i]);
		cmax = max(cmax,color[i]);
	}
	for(int i = 0;i < m;i++){
		scanf("%d %d",&a,&b);
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(0);
	int ans = *colors.begin();
	for(auto c : colors) {
		if(C[c].size() > C[ans].size())
			ans = c;
	}
	cout << ans << "\n";
	return 0;
}


#include <iostream>
#include <cmath>
#include <string>
#include <map>

using namespace std;

map <int, bool> color[100001];

int a[100001];
int s[100001];

int main()
{
	int n, m;
	cin>>n>>m;
	for (int i = 0; i<n; i++)
		cin>>a[i];
	int v, y;
	for (int i = 0; i<m; i++)
	{
		cin>>v>>y;
		v--;
		y--;
		if (a[v] != a[y] && color[a[v]].find(a[y]) == color[a[v]].end())
		{
			color[a[v]][a[y]] = true;
			color[a[y]][a[v]] = true;
			s[a[v]]++;
			s[a[y]]++;
		}

	}
	int ans = 0;
	int ians = 0;
	for (int i = 0; i<n; i++)
	{
		if (s[a[i]] > ans)
		{
			ans = s[a[i]];
			ians = a[i];
		}
		else if (s[a[i]] == ans && a[i]<ians)
			ians = a[i];
	}
	cout<<ians<<endl;
	return 0;
}


#include <iostream>
#include <cmath>
#include <string>
#include <map>

using namespace std;

map <int, bool> color[100001];

int a[100001];
int s[100001];

int main()
{
	int n, m;
	cin>>n>>m;
	for (int i = 0; i<n; i++)
		cin>>a[i];
	int v, y;
	for (int i = 0; i<m; i++)
	{
		cin>>v>>y;
		v--;
		y--;
		if (a[v] != a[y] && color[a[v]].find(a[y]) == color[a[v]].end())
		{
			color[a[v]][a[y]] = true;
			color[a[y]][a[v]] = true;
			s[a[v]]++;
			s[a[y]]++;
		}

	}
	int ans = -1;
	int ians = 0;
	for (int i = 0; i<n; i++)
	{
		if (s[a[i]] > ans)
		{
			ans = s[a[i]];
			ians = a[i];
		}
		else if (s[a[i]] == ans && a[i]<ians)
			ians = a[i];
	}
	cout<<ians<<endl;
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define FOREQ(i,k,n) for(int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); ++i)
#define SZ(v) (int)((v).size())
#define MEMSET(v,h) memset((v),(h),sizeof(v))

int c[100050];
bool v[100050];
set<int> d[100050];

int main() {
  int n, m; cin >> n >> m;
  REP(i, n) { cin >> c[i]; v[c[i]] = true; }

  REP(i, m) {
    int a, b; cin >> a >> b;
    --a, --b;
    int ca = c[a], cb = c[b];
    if(ca != cb) {
      d[ca].insert(cb);
      d[cb].insert(ca);
    }
  }

  int best = -1;
  int bestc = -1;
  REP(c, 100050) {
    if(v[c] && SZ(d[c]) > best) {
      best = SZ(d[c]);
      bestc = c;
    }
  }
  cout << bestc << endl;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define FOREQ(i,k,n) for(int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); ++i)
#define SZ(v) (int)((v).size())
#define MEMSET(v,h) memset((v),(h),sizeof(v))

int c[10050];
set<int> d[10050];

int main() {
  int n, m; cin >> n >> m;
  REP(i, n) cin >> c[i];

  REP(i, m) {
    int a, b; cin >> a >> b;
    --a, --b;
    int ca = c[a], cb = c[b];
    if(ca != cb) {
      d[ca].insert(cb);
      d[cb].insert(ca);
    }
  }

  int best = -1;
  int bestc = -1;
  REP(c, n) {
    if(SZ(d[c]) > best) {
      best = SZ(d[c]);
      bestc = c;
    }
  }
  cout << bestc << endl;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define FOREQ(i,k,n) for(int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); ++i)
#define SZ(v) (int)((v).size())
#define MEMSET(v,h) memset((v),(h),sizeof(v))

int c[100050];
set<int> d[100050];

int main() {
  int n, m; cin >> n >> m;
  REP(i, n) cin >> c[i];

  REP(i, m) {
    int a, b; cin >> a >> b;
    --a, --b;
    int ca = c[a], cb = c[b];
    if(ca != cb) {
      d[ca].insert(cb);
      d[cb].insert(ca);
    }
  }

  int best = -1;
  int bestc = -1;
  REP(c, n) {
    if(SZ(d[c]) > best) {
      best = SZ(d[c]);
      bestc = c;
    }
  }
  cout << bestc << endl;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define FOREQ(i,k,n) for(int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); ++i)
#define SZ(v) (int)((v).size())
#define MEMSET(v,h) memset((v),(h),sizeof(v))

int c[100050];
set<int> d[100050];

int main() {
  int n, m; cin >> n >> m;
  REP(i, n) cin >> c[i];

  REP(i, m) {
    int a, b; cin >> a >> b;
    --a, --b;
    int ca = c[a], cb = c[b];
    if(ca != cb) {
      d[ca].insert(cb);
      d[cb].insert(ca);
    }
  }

  int best = -1;
  int bestc = -1;
  REP(c, 100050) {
    if(SZ(d[c]) > best) {
      best = SZ(d[c]);
      bestc = c;
    }
  }
  cout << bestc << endl;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
const int max_color = 100000;
vector<set<int>> neighbours(max_color + 1);
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> color(n + 1);

	for (int vi = 1; vi <= n; ++vi) {
		cin >> color[vi];
	}
	for (int ei = 1; ei <= m; ++ei) {
		int u, v;
		cin >> u >> v;
		neighbours[color[u]].insert(color[v]);
		neighbours[color[v]].insert(color[u]);
	}
	int index = 0, max_neighbours = 0;
	for (int i = 1; i < neighbours.size(); ++i) {
		int n_neigh = neighbours[i].size();
		if (n_neigh > max_neighbours) {
			max_neighbours = n_neigh;
			index = i;
		}
	}
	cout << index << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
const int max_color = 100000;
vector<set<int>> neighbours(max_color + 1);
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> color(n + 1);

	for (int vi = 1; vi <= n; ++vi) {
		cin >> color[vi];
	}
	for (int ei = 1; ei <= m; ++ei) {
		int u, v;
		cin >> u >> v;
		if (color[u] != color[v]) {
			neighbours[color[u]].insert(color[v]);
			neighbours[color[v]].insert(color[u]);
		}
	}
	int index = 0, max_neighbours = -1;
	for (int vi = 1; vi <= n; vi++) {
		int col = color[vi];
		int n_neigh = neighbours[col].size();
		if (n_neigh > max_neighbours) {
			max_neighbours = n_neigh;
			index = col;
		} else if (n_neigh == max_neighbours) {
			index = min(index, col);
		}
	}
	cout << index << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
const int max_color = 100000;
vector<set<int>> neighbours(max_color + 1);
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> color(n + 1);

	for (int vi = 1; vi <= n; ++vi) {
		cin >> color[vi];
	}
	for (int ei = 1; ei <= m; ++ei) {
		int u, v;
		cin >> u >> v;
		if (color[u] != color[v]) {
			neighbours[color[u]].insert(color[v]);
			neighbours[color[v]].insert(color[u]);
		}
	}
	int index = 0, max_neighbours = -1;
	for (int i = 1; i < neighbours.size(); ++i) {
		int n_neigh = neighbours[i].size();
		if (n_neigh > max_neighbours) {
			max_neighbours = n_neigh;
			index = i;
		}
	}
	cout << index << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
const int max_color = 100000;
vector<set<int>> neighbours(max_color + 1);
int main() {
	int n, m;
	cin >> n >> m;
	vector<int> color(n + 1);

	for (int vi = 1; vi <= n; ++vi) {
		cin >> color[vi];
	}
	for (int ei = 1; ei <= m; ++ei) {
		int u, v;
		cin >> u >> v;
		neighbours[color[u]].insert(color[v]);
		neighbours[color[v]].insert(color[u]);
	}
	int index = 0, max_neighbours = -1;
	for (int i = 1; i < neighbours.size(); ++i) {
		int n_neigh = neighbours[i].size();
		if (n_neigh > max_neighbours) {
			max_neighbours = n_neigh;
			index = i;
		}
	}
	cout << index << endl;
	return 0;
}


#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int colors[100001];

map<int, set<int>> colMap;

void solve()
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> colors[i];

    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        colMap[colors[a]].insert(colors[b]);
        colMap[colors[b]].insert(colors[a]);
    }

    int max = 0;
    int color;
    for (auto& iter: colMap)
    {

        if (iter.second.size() > max)
        {
            max = iter.second.size();
            color = iter.first;
        }
        else if (iter.second.size() == max)
        {
            if (iter.first < color)
                color = iter.first;
        }
    }

    cout << color;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    solve();
    return 0;
}


#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int colors[100001];

set<int> colSet[100001];

void solve()
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> colors[i];

    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        colSet[a].insert(colors[b]);
        colSet[b].insert(colors[a]);
    }

    int maxColor = 0;
    int j;
    for (int i = 1; i <= n; i++)
    {
        if (colSet[i].size() > maxColor)
        {
            maxColor = colSet[i].size();
            j = i;
        }
        else if (colSet[i].size() == maxColor)
        {
            if (colors[i] < colors[j])
                j = i;
        }
    }

    cout << colors[j];
}

int main()
{
    //freopen("input.txt", "r", stdin);
    solve();
    return 0;
}


#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int colors[100001];
const int INF = 10000000;

map<int, set<int>> colMap;

void solve()
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> colors[i];

    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        if (colors[a] != colors[b])
        {
            colMap[colors[a]].insert(colors[b]);
            colMap[colors[b]].insert(colors[a]);
        }
    }

    int max = 0;
    int color = INF;
    for (int i = 1; i <= n; i++)
    {
        int c = colors[i];
        if (colMap[c].size() > max)
        {
            max = colMap[c].size();
            color = c;
        }
        else if (colMap[c].size() == max)
        {
            if (c < color)
                color = c;
        }
    }

    cout << color;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    solve();
    return 0;
}


//Name         : Shinchan Nohara
//Age          : 5 years
//Organisation : Kasukabe Defense Force

#include <iostream>
#include <ctime>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cassert>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <iterator>
#include <fstream>
using namespace std;

typedef long long 		int64;
typedef vector<int> 		vi;
typedef string 			ST;
typedef stringstream 		SS;
typedef vector< vector<int> > 	vvi;
typedef pair<int,int> 		ii;
typedef vector<string> 		vs;
/*
#if __cplusplus > 199711L	// for g++0x, value of __cplusplus must be greater thana 199711L.
	#define tr(i, c)	for(auto i = begin(c); i != end(c); i++)
#else
	#define tr(i, c)	for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#endif
*/
#define DEBUG(x)	cout << #x << " = " << x << "\n"
#define endl		("\n")
#define tr(i, c)	for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define PI		M_PI
#define E 		M_E
#define	ep		1e-9

#define	Sf		scanf
#define	Pf		printf

#define forn(i, n)	for(int i = 0, lets_stop_here = (int)n; i <  lets_stop_here; i++)
#define forab(i, a, b)	for(int i = a, lets_stop_here = (int)b; i <= lets_stop_here; i++)
#define rep(i, a, b)	for(int i = a, lets_stop_here = (int)b; i >= lets_stop_here; i--)

#define	all(c)		(c).begin(), (c).end()
#define	CL(a, b)	memset(a, b, sizeof(a))
#define mp		make_pair
#define pb		push_back

#define	present(x, c)	((c).find(x) != (c).end())	//map & set//
#define	cpresent(x, c)	(find( (c).begin(), (c).end(), x) != (c).end())	//vector & list//

#define read(n)		scanf("%d", &n)
#define write(n)	printf("%d ", n)
#define writeln(n)	printf("%d\n", n)

#ifdef DEBUG
	#undef DEBUG
#endif
#define DEBUG

int main()
{
	int N, M;
	cin >> N >> M;
	map <int, set <int> > G;

	vi color(N+1);
	forab(i, 1, N) {
		cin >> color[i];
	}

	forn(i, M) {
		int x, y;
		cin >> x >> y;
		int u = color[x], v = color[y];
		if(u == v)
			continue;
		G[u].insert(v);
		G[v].insert(u);
	}

	int ansColor = color[1];
	int mx = G.find(color[1]) == G.end() ? 0 : G[color[1]].size();

	forab(i, 2, N) {
		if(color[i] < ansColor) {
			DEBUG(color[i]);
			mx = G.find(color[i]) == G.end() ? 0 : G[color[i]].size();
			ansColor = color[i];
		}
	}
//	int ansColor = G.begin()->first, mx = G.begin()->second.size();

	tr(it, G) {
		if(it->second.size() > mx) {
			mx = it->second.size();
			ansColor = it->first;
		}
		else if(it->second.size() == mx && it->first < ansColor) {
			ansColor = it->first;
		}
	}
//	DEBUG(ansColor);
	cout << ansColor << endl;

	return 0;
}


//Name         : Shinchan Nohara
//Age          : 5 years
//Organisation : Kasukabe Defense Force

#include <iostream>
#include <ctime>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cassert>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <iterator>
#include <fstream>
using namespace std;

typedef long long 		int64;
typedef vector<int> 		vi;
typedef string 			ST;
typedef stringstream 		SS;
typedef vector< vector<int> > 	vvi;
typedef pair<int,int> 		ii;
typedef vector<string> 		vs;
/*
#if __cplusplus > 199711L	// for g++0x, value of __cplusplus must be greater thana 199711L.
	#define tr(i, c)	for(auto i = begin(c); i != end(c); i++)
#else
	#define tr(i, c)	for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#endif
*/
#define DEBUG(x)	cout << #x << " = " << x << "\n"
#define endl		("\n")
#define tr(i, c)	for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define PI		M_PI
#define E 		M_E
#define	ep		1e-9

#define	Sf		scanf
#define	Pf		printf

#define forn(i, n)	for(int i = 0, lets_stop_here = (int)n; i <  lets_stop_here; i++)
#define forab(i, a, b)	for(int i = a, lets_stop_here = (int)b; i <= lets_stop_here; i++)
#define rep(i, a, b)	for(int i = a, lets_stop_here = (int)b; i >= lets_stop_here; i--)

#define	all(c)		(c).begin(), (c).end()
#define	CL(a, b)	memset(a, b, sizeof(a))
#define mp		make_pair
#define pb		push_back

#define	present(x, c)	((c).find(x) != (c).end())	//map & set//
#define	cpresent(x, c)	(find( (c).begin(), (c).end(), x) != (c).end())	//vector & list//

#define read(n)		scanf("%d", &n)
#define write(n)	printf("%d ", n)
#define writeln(n)	printf("%d\n", n)
/*
#ifdef DEBUG
	#undef DEBUG
#endif
#define DEBUG
*/

int main()
{
	int N, M;
	cin >> N >> M;
	map <int, set <int> > G;

	vi color(N+1);
	forab(i, 1, N) {
		cin >> color[i];
	}

	forn(i, M) {
		int x, y;
		cin >> x >> y;
		int u = color[x], v = color[y];
		if(u == v)
			continue;
		G[u].insert(v);
		G[v].insert(u);
	}

	int ansColor = G.begin()->first, mx = G.begin()->second.size();

	tr(it, G) {
		if(it->second.size() > mx) {
			mx = it->second.size();
			ansColor = it->first;
		}
	}
//	DEBUG(ansColor);
	cout << ansColor << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;

int main() {
    ios_base::sync_with_stdio(false);
    int n,m,in; cin >> n >> m;
    vector<vi> c(1e5+1);
    vi color(n);
    for (int i=0;i<n;++i) {
        cin >> in;
        c[in].push_back(i);
        color[i]=in;
    }
    vector<vi> adj(n);
    for (int i=0;i<m;++i) {
        int b,e; cin >> b >> e;
        b--; e--;
        adj[b].push_back(e);
        adj[e].push_back(b);
    }
    int mx = 0, mxx=0;
    for (int i=1;i<1e5+1;++i) {
        int ct = 0;
        if (!mx && c[i].size()) mx=i;
        if (!c[i].size()) continue;
        vector<bool> got(1e5+1,false); got[i]=true;
        for (int k=0;k<c[i].size();++k) {
            for (int j=0;j<adj[c[i][k]].size();++j) {
                int v = adj[c[i][k]][j];
                if (!got[color[v]]) {++ct; got[color[v]]=true;}
            }
        }
        if (ct>mxx) {mxx=ct; mx=i;}
    }
    cout << mx << endl;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

int N,M;
int cs[100001];
vector<int> G[100001];
int cnts[100001];
int main(){

  fastStream();
  cin>>N>>M;
  for(int i=0;i<N;i++)cin>>cs[i];
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(cs[a]!=cs[b]){
      cnts[cs[a]]++,cnts[cs[b]]++;
    }
  }
  int val=-1;
  int idx=-1;
  for(int i=1;i<=100000;i++){
    if(val<cnts[i]){
      val=cnts[i];
      idx=i;
    }
  }
  //cout<<val<<endl;
  cout<<idx<<endl;

  return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

int N,K;
int as[51];
set<ll> used;
int main(){

  cin>>N>>K;
  for(int i=0;i<N;i++)cin>>as[i];
  sort(as,as+N,greater<int>());
  vector<int> cand;
  for(int i=0;i<N;i++){
    for(int j=i;j<N;j++){
      if(K>0){
        vector<int> v=cand;
        v.push_back(as[j]);
        cout<<v.size();
        for(int k=0;k<(int)v.size();k++)
          cout<<" "<<v[k];
        cout<<endl;
        K--;
      }
    }
    cand.push_back(as[i]);
  }

  return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

int N,M;
int cs[100001];
set<int> cnts[100001];
bool exists[100001];
int main(){

  fastStream();
  cin>>N>>M;
  for(int i=0;i<N;i++){
    cin>>cs[i];
    exists[cs[i]]=true;
  }
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(cs[a]!=cs[b]){
      cnts[cs[a]].insert(cs[b]);
      cnts[cs[b]].insert(cs[a]);
    }
  }
  int val=-1;
  int idx=-1;
  for(int i=1;i<=100000;i++){
    if(!exists[i])continue;
    if(val<(int)cnts[i].size()){
      val=cnts[i].size();
      idx=i;
    }
  }
  cout<<idx<<endl;

  return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

int N,M;
int cs[100001];
vector<int> G[100001];
set<int> cnts[100001];
int main(){

  fastStream();
  cin>>N>>M;
  for(int i=0;i<N;i++)cin>>cs[i];
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(cs[a]!=cs[b]){
      cnts[cs[a]].insert(cs[b]);
      cnts[cs[b]].insert(cs[a]);
    }
  }
  int val=-1;
  int idx=-1;
  for(int i=1;i<=100000;i++){
    if(val<(int)cnts[i].size()){
      val=cnts[i].size();
      idx=i;
    }
  }
  //cout<<val<<endl;
  cout<<idx<<endl;

  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <set>
using namespace std;

void solve(istream &in, ostream &out) {
	int n, m;
	in >> n >> m;
	vector<int> c(n);
	for (int i = 0; i < n; ++i)
		in >> c[i];
	map<int, set<int> > q;
	for (int i = 0; i < m; ++i) {
		int a, b;
		in >> a >> b;
		--a, --b;
		if (c[a] != c[b]) {
			q[c[a]].insert(c[b]);
			q[c[b]].insert(c[a]);
		}
	}
	out
			<< max_element(q.begin(), q.end(),
					[](pair<int,set<int> > lhs,pair<int,set<int> > rhs) {
						return lhs.second.size() < rhs.second.size();
					})->first << endl;
	;
}

int main() {
	solve(cin, cout);
	return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

bool compare(const pair<int, set<int> > &lhs, const pair<int, set<int> > &rhs) {
  return lhs.second.size() < rhs.second.size();
}

void solve(istream &in, ostream &out)
{
  int n, m;
  in >> n >> m;
  int color[n];
  map<int, set<int> > nei;
  for (int i = 0; i < n; ++i) {
    in >> color[i];
    nei[color[i]] = set<int>();
  }

  for (int i = 0; i < m; ++i) {
    int a, b;
    in >> a >> b;
    --a, --b;
    if (color[a] != color[b]) {
      nei[color[a]].insert(color[b]);
      nei[color[b]].insert(color[a]);
    }
  }

  out << max_element(nei.begin(), nei.end(), compare)->first;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

bool pairCompare(const std::pair<int,set<int> > & x, const std::pair<int,set<int> > & y) {
    return x.second.size() < y.second.size();
}

void solve(istream &in, ostream &out)
{
  int n, m;
  in >> n >> m;
  vector<int> c(n);
  map<int, set<int> > cl;
  for (int i = 0; i < n; ++i) {
    in >> c[i];
    cl[c[i]] = set<int>();
  }

  for (int i = 0; i < m; ++i) {
    int from, to;
    in >> from >> to;
    --from, --to;

    if (c[from] != c[to]) {
      cl[c[from]].insert(c[to]);
      cl[c[to]].insert(c[from]);
    }
  }

  out << max_element(cl.begin(), cl.end(), pairCompare)->first;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <set>
using namespace std;

void solve(istream &in, ostream &out) {
	int n, m;
	in >> n >> m;
	vector<int> c(n);
	for (int i = 0; i < n; ++i)
		in >> c[i];
	map<int, set<int> > q;
	for (int i = 0; i < m; ++i) {
		int a, b;
		in >> a >> b;
		--a, --b;
		if (c[a] != c[b]) {
			q[c[a]].insert(c[b]);
			q[c[b]].insert(c[a]);
		}
	}

	if (q.empty())
		out << *min_element(c.begin(), c.end()) << endl;
	else
		out
				<< max_element(q.begin(), q.end(),
						[](pair<int,set<int> > lhs,pair<int,set<int> > rhs) {
							return lhs.second.size() < rhs.second.size();
						})->first << endl;
}

int main() {
	solve(cin, cout);
	return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

bool pairCompare(const std::pair<int,int> & x,
                 const std::pair<int,int> & y) {
  return x.second < y.second;
}

void solve(istream &in, ostream &out)
{
  int n, m;
  in >> n >> m;
  vector<int> c(n);
  map<int, int> cl;
  for (int i = 0; i < n; ++i)
    in >> c[i];

  for (int i = 0; i < m; ++i) {
    int from, to;
    in >> from >> to;
    --from, --to;

    if (c[from] != c[to]) {
      ++cl[c[from]];
      ++cl[c[to]];
    }
  }

  out << max_element(cl.begin(), cl.end(), pairCompare)->first;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

bool compare(const pair<int, set<int> > &lhs, const pair<int, set<int> > &rhs) {
	return lhs.second.size() < rhs.second.size();
}

void solve(istream &in, ostream &out)
{
	int n, m;
	in >> n >> m;
	map<int, set<int> > p;
	int c[n];
	for (int i = 0; i < n; ++i) {
		in >> c[i];
		p[c[i]] = set<int>();
	}
	for (int i = 0; i < m; ++i) {
		int a, b;
		in >> a >> b;
		--a, --b;
		if (c[a] != c[b]) {
			p[c[a]].insert(c[b]);
			p[c[b]].insert(c[a]);
		}
	}

	out << max_element(p.begin(), p.end(), compare)->first;
}

int main() {
	solve(cin, cout);
	return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
typedef pair<int, set<int> > P;

class Solver {
  map<int, set<int> > p;
  const vector<int> &c;
public:
  Solver(const vector<int> &c) : c(c) {
    for (auto a : c)
      p[a] = set<int>();
  }

  void push(int a, int b) {
    if (c[a] != c[b]) {
      p[c[a]].insert(c[b]);
      p[c[b]].insert(c[a]);
    }
  }

  int result() {
    return max_element(p.begin(), p.end(), compare)->first;
  }

  static bool compare(const P &lhs, const P &rhs) {
    return lhs.second.size() < rhs.second.size();
  }
};

void solve(istream &in, ostream &out)
{
  int n, m;
  in >> n >> m;
  vector<int> c(n);

  for (int i = 0; i < n; ++i)
    in >> c[i];

  Solver p(c);
  for (int i = 0; i < m; ++i) {
    int a, b;
    in >> a >> b;
    --a, --b;
    p.push(a, b);
  }

  out << p.result() << endl;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

bool compare(const pair<int, set<int> > &lhs, const pair<int, set<int> > &rhs) {
	return lhs.second.size() < rhs.second.size();
}

void solve(istream &in, ostream &out)
{
	int n, m;
	in >> n >> m;
	map<int, set<int> > p;
	int c[n];
	for (int i = 0; i < n; ++i) {
		in >> c[i];
		p[c[i]] = set<int>();
	}
	for (int i = 0; i < m; ++i) {
		int a, b;
		in >> a >> b;
		--a, --b;
		if (c[a] != c[b]) {
			p[c[a]].insert(c[b]);
			p[c[b]].insert(c[a]);
		}
	}

	out << max_element(p.begin(), p.end(), compare)->first;
}

#include <gtest/gtest.h>

TEST(A, 0) {
  stringstream in, out;
  in << "6 6" << endl <<
    "1 1 2 3 5 8" << endl <<
    "1 2" << endl <<
    "3 2" << endl <<
    "1 4" << endl <<
    "4 3" << endl <<
    "4 5" << endl <<
    "4 6" << endl;
  solve(in, out);
  ASSERT_EQ("3", out.str());
}

TEST(A, 1) {
  stringstream in, out;
  in << "5 6" << endl <<
    "4 2 5 2 4" << endl <<
    "1 2" << endl <<
    "2 3" << endl <<
    "3 1" << endl <<
    "5 3" << endl <<
    "5 4" << endl <<
    "3 4" << endl;
  solve(in, out);
  ASSERT_EQ("2", out.str());
}

TEST(A, 2) {
  stringstream in, out;
  in << "3 1" << endl <<
    "13 13 4" << endl <<
    "1 2" << endl;
  solve(in, out);
  ASSERT_EQ("4", out.str());
}

TEST(A, 4) {
  stringstream in, out;
  in << "9 9" << endl <<
    "1 1 2 3 5 8 8 8 8" << endl <<
    "1 2" << endl <<
    "3 2" << endl <<
    "1 4" << endl <<
    "4 3" << endl <<
    "4 5" << endl <<
    "4 6" << endl <<
    "1 7" << endl <<
    "1 8" << endl <<
    "1 9" << endl;
  solve(in, out);
  ASSERT_EQ("3", out.str());
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

bool compare(const pair<int, set<int> > &lhs, const pair<int, set<int> > &rhs) {
  return lhs.second.size() < rhs.second.size();
}

void solve(istream &in, ostream &out)
{
  int n, m;
  in >> n >> m;
  int c[n];

  map<int, set<int> > v;
  for (int i = 0; i < n; ++i) {
    in >> c[i];
    v[c[i]] = set<int>();
  }

  for (int i = 0; i < m; ++i) {
    int e1, e2;
    in >> e1 >> e2;
    --e1, --e2;

    if (c[e1] != c[e2]) {
      v[c[e1]].insert(c[e2]);
      v[c[e2]].insert(c[e1]);
    }
  }

  out << max_element(v.begin(), v.end(), compare)->first;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

bool pairCompare(const std::pair<int,int> & x,
                 const std::pair<int,int> & y) {
  return x.second < y.second;
}

void solve(istream &in, ostream &out)
{
  int n, m;
  in >> n >> m;
  vector<int> c(n);
  map<int, int> cl;
  for (int i = 0; i < n; ++i) {
    in >> c[i];
    cl[c[i]] = 0;
  }

  for (int i = 0; i < m; ++i) {
    int from, to;
    in >> from >> to;
    --from, --to;

    if (c[from] != c[to]) {
      ++cl[c[from]];
      ++cl[c[to]];
    }
  }

  out << max_element(cl.begin(), cl.end(), pairCompare)->first;
}

int main() {
  solve(cin, cout);
  return 0;
}