#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool myComparison(const pair<string,int> &a,const pair<string,int> &b)
{
       return a.second>b.second;
}
int main()
{
   ll n,m;
   while (cin>>n>>m)
   {
       vector< pair<string,int> >v[100005];
       pair<string,int>p;
       for (ll i=0;i<n;i++)
       {
           string s;
           int a,b,c;
           cin>>s>>a>>b;
           p = make_pair(s,b);
           v[a].push_back(p);
       }
       for(ll i=0;i<m;i++)
       {
           sort(v[i+1].begin(),v[i+1].end(),myComparison);
          /* for(ll j=0;j<v[i+1].size();j++)
           {
               cout<<v[i+1][j].first<<" "<<v[i+1][j].second<<endl;
           }*/

       }
       for (ll i=0;i<m;i++)
       {
           ll cnt=0;
           for (ll j=0;j<v[i+1].size();j++)
            if( v[i+1][0].second==v[i+1][j].second)
           {
               cnt++;
           }
           ll cc=0;
          for (ll j=2;j<v[i+1].size();j++)
            if( v[i+1][1].second==v[i+1][j].second)
           {
               cc++;
           }
           if (cc>=2 || cnt >1)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
           /* if (v[i+1][2].second == v[i+1][1].second)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
           */
       }
   }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool myComparison(const pair<string,int> &a,const pair<string,int> &b)
{
       return a.second>b.second;
}
int main()
{
   ll n,m;
   while (cin>>n>>m)
   {
       vector< pair<string,int> >v[100005];
       pair<string,int>p;
       for (ll i=0;i<n;i++)
       {
           string s;
           int a,b,c;
           cin>>s>>a>>b;
           p = make_pair(s,b);
           v[a].push_back(p);
       }
       for(ll i=0;i<m;i++)
       {
           sort(v[i+1].begin(),v[i+1].end(),myComparison);
          /* for(ll j=0;j<v[i+1].size();j++)
           {
               cout<<v[i+1][j].first<<" "<<v[i+1][j].second<<endl;
           }*/
           if (v[i+1][2].second==v[i+1][1].second)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
       }
   }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool myComparison(const pair<string,int> &a,const pair<string,int> &b)
{
       return a.second>b.second;
}
int main()
{
   ll n,m;
   while (cin>>n>>m)
   {
       vector< pair<string,int> >v[100005];
       pair<string,int>p;
       for (ll i=0;i<n;i++)
       {
           string s;
           int a,b,c;
           cin>>s>>a>>b;
           p = make_pair(s,b);
           v[a].push_back(p);
       }
       for(ll i=0;i<m;i++)
       {
           sort(v[i+1].begin(),v[i+1].end(),myComparison);
          /* for(ll j=0;j<v[i+1].size();j++)
           {
               cout<<v[i+1][j].first<<" "<<v[i+1][j].second<<endl;
           }*/
           if (v[i+1][2].second == v[i+1][1].second)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
       }
   }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool myComparison(const pair<string,int> &a,const pair<string,int> &b)
{
       return a.second>b.second;
}
int main()
{
   ll n,m;
   while (cin>>n>>m)
   {
       vector< pair<string,int> >v[100005];
       pair<string,int>p;
       for (ll i=0;i<n;i++)
       {
           string s;
           int a,b,c;
           cin>>s>>a>>b;
           p = make_pair(s,b);
           v[a].push_back(p);
       }
       for(ll i=0;i<m;i++)
       {
           sort(v[i+1].begin(),v[i+1].end(),myComparison);
          /* for(ll j=0;j<v[i+1].size();j++)
           {
               cout<<v[i+1][j].first<<" "<<v[i+1][j].second<<endl;
           }*/

       }
       for (ll i=0;i<m;i++)
       {
           ll cnt=0;
           for (ll j=0;j<v[i+1].size();j++)
            if( v[i+1][0].second==v[i+1][j].second)
           {
               cnt++;
           }
           ll cc=0;
          for (ll j=0;j<v[i+1].size();j++)
            if( v[i+1][1].second==v[i+1][j].second)
           {
               cc++;
           }
           if (cc>2 || cnt >1)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
           /* if (v[i+1][2].second == v[i+1][1].second)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
           */
       }
   }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool myComparison(const pair<string,int> &a,const pair<string,int> &b)
{
       return a.second>b.second;
}
int main()
{
   ll n,m;
   while (cin>>n>>m)
   {
       vector< pair<string,int> >v[100005];
       pair<string,int>p;
       for (ll i=0;i<n;i++)
       {
           string s;
           int a,b,c;
           cin>>s>>a>>b;
           p = make_pair(s,b);
           v[a].push_back(p);
       }
       for(ll i=0;i<m;i++)
       {
           sort(v[i+1].begin(),v[i+1].end(),myComparison);
          /* for(ll j=0;j<v[i+1].size();j++)
           {
               cout<<v[i+1][j].first<<" "<<v[i+1][j].second<<endl;
           }*/

       }
       for (ll i=0;i<m;i++)
       {
           ll cnt=1;
           for (ll j=1;j<v[i+1].size();j++)
            if( v[i+1][0].second==v[i+1][j].second)
           {
               cnt++;
           }
           ll cc=1;
          for (ll j=2;j<v[i+1].size();j++)
            if( v[i+1][1].second==v[i+1][j].second)
           {
               cc++;
           }
           if (cnt>2 || cc >1)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
           /* if (v[i+1][2].second == v[i+1][1].second)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
           */
       }
   }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool myComparison(const pair<string,int> &a,const pair<string,int> &b)
{
       return a.second>=b.second;
}
int main()
{
   ll n,m;
   while (cin>>n>>m)
   {
       vector< pair<string,int> >v[100005];
       pair<string,int>p;
       for (ll i=0;i<n;i++)
       {
           string s;
           int a,b,c;
           cin>>s>>a>>b;
           p = make_pair(s,b);
           v[a].push_back(p);
       }
       for(ll i=0;i<m;i++)
       {
           sort(v[i+1].begin(),v[i+1].end(),myComparison);
          /* for(ll j=0;j<v[i+1].size();j++)
           {
               cout<<v[i+1][j].first<<" "<<v[i+1][j].second<<endl;
           }*/
           if (v[i+1][2].second==v[i+1][1].second)
            cout<<"?"<<endl;
           else
           {
               p =v[i+1][0];
               pair<string,int>d;
               d=v[i+1][1];
               cout<<p.first<<" "<<d.first<<endl;
           }
       }
   }
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            //if(p.name==""&&p.score>0)cout<<p.reg<<endl;
            Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=-1;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        //if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;
        //if(name=="PQE" && n==20000)cout<<"PQE: "<<region[reg][0].name<<" "<<region[reg][1].name<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;

            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            //if(region[reg][1].name==""&&name=="PQE")cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            /*Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;*/
            region[reg][0].name=name;
            region[reg][0].reg=reg;
            region[reg][0].score=score;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            /*Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;*/
            region[reg][1].name=name;
            region[reg][1].reg=reg;
            region[reg][1].score=score;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
using namespace std;

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][0].score<score){
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][0]=p;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
        else if(region[reg][1].score==score)regsec[reg]++;
    }
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][0]=p;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;

            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            //if(region[reg][1].name==""&&name=="PQE")cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            /*Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;*/
            region[reg][0].name=name;
            region[reg][0].reg=reg;
            region[reg][0].score=score;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            /*Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;*/
            region[reg][1].name=name;
            region[reg][1].reg=reg;
            region[reg][1].score=score;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            if(region[reg][1].name==""&&region[reg][1].score==0)cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][0]=p;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            //if(p.name==""&&)cout<<p.reg<<endl;
            Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][0]=p;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            //if(p.name==""&&p.score>0)cout<<p.reg<<endl;
            Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;
        if(name=="PQE")cout<<"PQE: "<<region[reg][0].name<<" "<<region[reg][1].name<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;

            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            //if(region[reg][1].name==""&&name=="PQE")cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            /*Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;*/
            region[reg][0].name=name;
            region[reg][0].reg=reg;
            region[reg][0].score=score;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            /*Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;*/
            region[reg][1].name=name;
            region[reg][1].reg=reg;
            region[reg][1].score=score;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;
        if(name=="PQE" && n==20000)cout<<"PQE: "<<region[reg][0].name<<" "<<region[reg][1].name<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;

            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            //if(region[reg][1].name==""&&name=="PQE")cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            /*Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;*/
            region[reg][0].name=name;
            region[reg][0].reg=reg;
            region[reg][0].score=score;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            /*Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;*/
            region[reg][1].name=name;
            region[reg][1].reg=reg;
            region[reg][1].score=score;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;

            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            if(region[reg][1].name==""&&name=="PQE")cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            /*Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;*/
            region[reg][0].name=name;
            region[reg][0].reg=reg;
            region[reg][0].score=score;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            /*Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;*/
            region[reg][1].name=name;
            region[reg][1].reg=reg;
            region[reg][1].score=score;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
using namespace std;

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][0]=p;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    cout<<region[0][0].name<<endl;
}


#include <iostream>
using namespace std;

string debug="";

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(reg==730 && m==10000)debug+= "" + score + " ";
        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][0]=p;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    cout<<debug<<endl;
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            if(region[reg][1].name==""&&name=="PQE")cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;
        if(name=="")cout<<"Sring vacio, ayuda!!!"<<endl;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            //Participant p(region[reg][0]);
            region[reg][1].name=region[reg][0].name;
            region[reg][1].score=region[reg][0].score;
            region[reg][1].reg=region[reg][0].reg;

            //region[reg][1]=p;
            if(region[reg][1].name==""&&region[reg][1].score>0)cout<<"Sring vacio, ayuda!!!"<<region[reg][1].reg<<endl;
            Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    /*for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }*/
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

//vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;

        /*if(reg==730 && m==10000)
            debug.push_back(score);*/

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regsec[reg]=regtop[reg];
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            if(p.name=="")cout<<p.reg<<endl;
            Participant q;
            q.name=name;
            q.reg=reg;
            q.score=score;
            region[reg][0]=q;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    /*for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";*/
    for(int x=0;x<m;x++){
        if(region[x+1][0].name=="" || region[x+1][1].name=="")
            cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<" "<<x+1<<endl;
    }
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <iostream>
#include <vector>
using namespace std;

vector<int> debug= vector<int>();

int n;
int m;

struct Participant {
    string name;
    int reg;
    int score;
    Participant(){}
    Participant(Participant* p){
        name=(*p).name;
        reg=(*p).reg;
        score=(*p).score;
    }
};
Participant region[10100][2];
int regtop[10100]={0};
int regsec[10100]={0};

int main(){
    for(int x=0;x<20200;x++)
    {
        region[x/2][x%2].score=0;
    }

    cin>>n;
    cin>>m;
    for(int x=0;x<n;x++){
        string name;
        int reg;
        int score;
        cin>>name;
        cin>>reg;
        cin>>score;

        if(reg==730 && m==10000)
            debug.push_back(score);

        if(region[reg][0].score==score)regtop[reg]++;
        if(region[reg][1].score==score)regsec[reg]++;
        if(region[reg][0].score<score){
            regtop[reg]=1;
            Participant p(region[reg][0]);
            region[reg][1]=p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][0]=p;
            //cout<<region[reg][0].name;
        }
        else if(region[reg][1].score<score){
            regsec[reg]=1;
            Participant p;
            p.name=name;
            p.reg=reg;
            p.score=score;
            region[reg][1]=p;
        }
    }
    for(int x=0;x<debug.size();x++)
        cout<<debug.at(x)<<" ";
    for(int x=0;x<m;x++){
        if(regtop[x+1]>2){cout<<"?"<<endl;continue;}
        if(regsec[x+1]>1){cout<<"?"<<endl;continue;}
        cout<<region[x+1][0].name<<" "<<region[x+1][1].name<<endl;
    }
    //cout<<region[0][0].name<<endl;
}


#include <bits/stdc++.h>

using namespace std;
int N, M;
struct my{string nume; int m, p;};
my A[1000005];
int cnt[100005];
bool cmp(my a, my b){
    return ((a.m < b.m) || (a.m == b.m && a.p >= b.p));
}
int main(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> A[i].nume >> A[i].m >> A[i].p, cnt[A[i].m]++;
    sort(A+1, A+N+1, cmp);
    int j = 1;
    for(int i = 1; i <= N-1 && j <= M; i++){
        if(A[i].m == j && A[i+1].m == j){
            if(cnt[j] == 2) cout << A[i].nume << " " << A[i+1].nume << "\n";
            else
                if(i+2 <= N)
                    if(A[i].p != A[i+2].p) cout << A[i].nume << " " << A[i+1].nume << "\n";
                        else cout << "?\n";
            j++;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int N, M;
struct my{string nume; int m, p;};
my A[1000005];
int cnt[100005];
bool cmp(my a, my b){
    return ((a.m < b.m) || (a.m == b.m && a.p > b.p));
}
int main(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> A[i].nume >> A[i].m >> A[i].p, cnt[A[i].m]++;
    sort(A+1, A+N+1, cmp);
    int j = 1;

    for(int i = 1; i <= N-1; i++){
        if(A[i].m == j && A[i+1].m == j){
            if(cnt[j] == 2) cout << A[i].nume << " " << A[i+1].nume << "\n";
            if(i+2 <= N && cnt[j] > 2)
                    if(A[i+1].p == A[i+2].p) cout << "?\n";
                        else cout << A[i].nume << " " << A[i+1].nume << "\n";
            j++;
            if(j > M) return 0;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int N, M;
struct my{string nume; int m, p;};
my A[100005];
int cnt[100005];
bool cmp(my a, my b){
    return ((a.m < b.m) || (a.m == b.m && a.p >= b.p));
}
int main(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> A[i].nume >> A[i].m >> A[i].p, cnt[A[i].m]++;
    sort(A+1, A+N+1, cmp);
    int j = 1;
    for(int i = 1; i <= N && j <= M; i++){
        if(A[i].m == j && A[i+1].m == j){
            if(cnt[j] == 2) cout << A[i].nume << " " << A[i+1].nume << "\n";
            else if((A[i].p == A[i+1].p && A[i].p != A[i+2].p) || (A[i].p != A[i+1].p && A[i].p != A[i+2].p)) cout << A[i].nume << " " << A[i+1].nume << "\n";
                    else cout << "?\n";
            j++;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int N, M;
struct my{string nume; int m, p;};
my A[1000005];
int cnt[100005];
bool cmp(my a, my b){
    return ((a.m < b.m) || (a.m == b.m && a.p >= b.p));
}
int main(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> A[i].nume >> A[i].m >> A[i].p, cnt[A[i].m]++;
    sort(A+1, A+N+1, cmp);
    int j = 1;

    for(int i = 1; i <= N-1; i++){
        if(A[i].m == j && A[i+1].m == j){
            if(cnt[j] == 2) cout << A[i].nume << " " << A[i+1].nume << "\n";
            if(i+2 <= N && cnt[j] > 2)
                    if(A[i+1].p == A[i+2].p) cout << "?\n";
                        else cout << A[i].nume << " " << A[i+1].nume << "\n";
            j++;
            if(j > M) return 0;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int N, M;
struct my{string nume; int m, p;};
my A[100005];
int cnt[10005];
bool cmp(my a, my b){
    return ((a.m < b.m) || (a.m == b.m && a.p >= b.p));
}
int main(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> A[i].nume >> A[i].m >> A[i].p, cnt[A[i].m]++;
    sort(A+1, A+N+1, cmp);
    int j = 1;
    for(int i = 1; i <= N && j <= M; i++){
        if(A[i].m == j && A[i+1].m == j){
            if(cnt[j] == 2) cout << A[i].nume << " " << A[i+1].nume << "\n";
            else if(A[i].p == A[i+1].p && A[i].p != A[i+2].p || A[i].p != A[i+1].p && A[i].p != A[i+2].p) cout << A[i].nume << " " << A[i+1].nume << "\n";
                    else cout << "?\n";
            j++;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int N, M;
struct my{string nume; int m, p;};
my A[100005];
int cnt[10005];
bool cmp(my a, my b){
    return ((a.m < b.m) || (a.m == b.m && a.p > b.p));
}
int main(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> A[i].nume >> A[i].m >> A[i].p, cnt[A[i].m]++;
    sort(A+1, A+N+1, cmp);
    int j = 1;

    for(int i = 1; i <= N-1; i++){
        if(A[i].m == j && A[i+1].m == j){
            if(cnt[j] == 2) cout << A[i].nume << " " << A[i+1].nume << "\n";
            if(i+2 <= N && cnt[j] > 2)
                    if(A[i+1].p == A[i+2].p) cout << "?\n";
                        else cout << A[i].nume << " " << A[i+1].nume << "\n";
            j++;
            if(j > M) return 0;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int N, M;
struct my{string nume; int m, p;};
my A[1000005];
int cnt[1000005];
bool cmp(my a, my b){
    return ((a.m < b.m) || (a.m == b.m && a.p >= b.p));
}
int main(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> A[i].nume >> A[i].m >> A[i].p, cnt[A[i].m]++;
    sort(A+1, A+N+1, cmp);
    int j = 1;
    for(int i = 1; i <= N-1 && j <= M; i++){
        if(A[i].m == j && A[i+1].m == j){
            if(cnt[j] == 2) cout << A[i].nume << " " << A[i+1].nume << "\n";
            else
                if(i+2 <= N)
                    if(A[i+1].p != A[i+2].p) cout << A[i].nume << " " << A[i+1].nume << "\n";
                        else cout << "?\n";
            j++;
        }
    }
    return 0;
}


#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define sz(x) ((int)(x).size())
#define re return
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ((x) * (x))
#define all(x) x.begin(), x.end()
#define fname "a"
#define MOD 1000000007

typedef long long ll;

ll n, m, region, score;
string s;
vector < pair <int, string > > regs[111111];

int main() {

	//ios_base::sync_with_stdio(0);

	#ifndef ONLINE_JUDGE
		freopen("a.in", "r", stdin);
	#endif

	cin >> n >> m;

	for(int i = 1; i <= n; i++) {
		cin >> s >> region >> score;
		regs[region].pb(mp(score, s));
	}

	for(int i = 1; i <= m; i++)
		sort(all(regs[i])), reverse(all(regs[i]));

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

		if(sz(regs[i]) <= 2)
			cout << regs[i][0].se << " " << regs[i][1].se << endl;

        else if(regs[i][1].fi == regs[i][2].fi)
            puts("?");

        else
            cout << regs[i][0].se << " " << regs[i][1].se << endl;

	}

	return 0;
}


#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define sz(x) ((int)(x).size())
#define re return
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ((x) * (x))
#define all(x) x.begin(), x.end()
#define fname "a"
#define MOD 1000000007

typedef long long ll;

ll n, m, region, score;
string s;
vector < pair <int, string > > regs[111111];

int main() {

//	ios_base::sync_with_stdio(0);

	#ifndef ONLINE_JUDGE
		freopen("a.in", "r", stdin);
	#endif

	cin >> n >> m;

	for(int i = 1; i <= n; i++) {
		cin >> s >> region >> score;
		regs[region].pb(mp(score, s));
	}

	for(int i = 1; i <= m; i++)
		sort(all(regs[i])), reverse(all(regs[i]));

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

		if(sz(regs[i]) == 2)
			cout << regs[i][0].se << " " << regs[i][1].se << endl;
		else {
			if(regs[i][0].fi == regs[i][1].fi && regs[i][1].fi == regs[i][2].fi)
				puts("?");
			else
			if(regs[i][0].fi != regs[i][1].fi && regs[i][1].fi == regs[i][2].fi)
				puts("?");
			else
				cout << regs[i][0].se << " " << regs[i][1].se << endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define str(x) (int)strlen(x)
#define all(x) x.begin(), x.end()
#define itr ::iterator
#define rt return
#define sf scanf
#define pf printf
#define bit __builtin_popcountll
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define SABR inline ll IN(){ll x=0,ch=getchar(),f=1;while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();if (ch=='-'){f=-1;ch=getchar();}while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}inline void OUT(ll x){if (x<0) putchar('-'),x=-x;if (x>=10) OUT(x/10),putchar(x%10+'0');else putchar(x+'0');}
#define PI 3.14159265358979323846264338327950288419716939937510

using namespace std;

typedef long long ll;
typedef unsigned uns;
typedef pair <int, int> pi;
typedef pair <ll, ll> pl;
typedef vector <int> vi;
typedef vector <ll> vl;

const int MX = (int) 1e6 + 17;
const int MOD = (int) 1e9 + 7;
const long long   oo = (ll) 1e18 + 7;
const int INF = (int) 999999999;
const int N = (int)1e5 + 17;
SABR

    int n, m;
    string x;
    int y, z;
    multiset <pair <int, string> > a[11111];
    multiset <pair <int, string> >itr it;
int main()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
    {
        cin >> x >> y >> z;
        a[y].insert(mp(z, x));
    }

    for (int i = 1; i <= m; i++)
    {
        string FF, SS;
        int f, s;
        it = a[i].end();
        it--;
        f = it->F;
        FF = it->S;
        it--;
        s = it->F;
        SS = it->S;
        if (f != s) cout << FF << ' ' << SS << endl;
        else cout << "?" << endl;
    }

return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define str(x) (int)strlen(x)
#define all(x) x.begin(), x.end()
#define itr ::iterator
#define rt return
#define sf scanf
#define pf printf
#define bit __builtin_popcountll
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define SABR inline ll IN(){ll x=0,ch=getchar(),f=1;while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();if (ch=='-'){f=-1;ch=getchar();}while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}inline void OUT(ll x){if (x<0) putchar('-'),x=-x;if (x>=10) OUT(x/10),putchar(x%10+'0');else putchar(x+'0');}
#define PI 3.14159265358979323846264338327950288419716939937510

using namespace std;

typedef long long ll;
typedef unsigned uns;
typedef pair <int, int> pi;
typedef pair <ll, ll> pl;
typedef vector <int> vi;
typedef vector <ll> vl;

const int MX = (int) 1e6 + 17;
const int MOD = (int) 1e9 + 7;
const long long   oo = (ll) 1e18 + 7;
const int INF = (int) 999999999;
const int N = (int)1e5 + 17;
SABR

    int n, m;
    string x;
    int y, z;
    set <pair <int, string> > a[11111];
    set <pair <int, string> >itr it;
int main()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
    {
        cin >> x >> y >> z;
        a[y].insert(mp(z, x));
    }

    for (int i = 1; i <= m; i++)
    {
        string FF, SS;
        int f, s;
        it = a[i].end();
        it--;
        f = it->F;
        FF = it->S;
        it--;
        s = it->F;
        SS = it->S;
        if (f != s || sz(a[i]) < 3) cout << FF << ' ' << SS << endl;
        else cout << "?" << endl;
    }

return 0;
}


#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define sz(x) ((int)(x).size())
#define re return
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ((x) * (x))
#define all(x) x.begin(), x.end()
#define fname "a"
#define MOD 1000000007

typedef long long ll;

ll n, m, region, score;
string s;
vector < pair <int, string > > regs[111111];

int main() {

	ios_base::sync_with_stdio(0);

	#ifndef ONLINE_JUDGE
		freopen("a.in", "r", stdin);
	#endif

	cin >> n >> m;

	for(int i = 1; i <= n; i++) {
		cin >> s >> region >> score;
		regs[region].pb(mp(score, s));
	}

	for(int i = 1; i <= m; i++)
		sort(all(regs[i])), reverse(all(regs[i]));

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

		if(sz(regs[i]) == 2)
			cout << regs[i][0].se << " " << regs[i][1].se << endl;
		else {
			if(regs[i][0].fi == regs[i][1].fi && regs[i][1].fi == regs[i][2].fi)
				puts("?");
			else
			if(regs[i][0].fi != regs[i][1].fi && regs[i][1].fi == regs[i][2].fi)
				puts("?");
			else
				cout << regs[i][0].se << " " << regs[i][1].se << endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define str(x) (int)strlen(x)
#define all(x) x.begin(), x.end()
#define itr ::iterator
#define rt return
#define sf scanf
#define pf printf
#define bit __builtin_popcountll
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define SABR inline ll IN(){ll x=0,ch=getchar(),f=1;while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();if (ch=='-'){f=-1;ch=getchar();}while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}inline void OUT(ll x){if (x<0) putchar('-'),x=-x;if (x>=10) OUT(x/10),putchar(x%10+'0');else putchar(x+'0');}
#define PI 3.14159265358979323846264338327950288419716939937510

using namespace std;

typedef long long ll;
typedef unsigned uns;
typedef pair <int, int> pi;
typedef pair <ll, ll> pl;
typedef vector <int> vi;
typedef vector <ll> vl;

const int MX = (int) 1e6 + 17;
const int MOD = (int) 1e9 + 7;
const long long   oo = (ll) 1e18 + 7;
const int INF = (int) 999999999;
const int N = (int)1e5 + 17;
SABR

    int n, m;
    string x;
    int y, z;
    vector <pair <int, string> > a[11111];
int main()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
    {
        cin >> x >> y >> z;
        a[y].pb(mp(z, x));
    }

    for (int i = 1; i <= m; i++)
    {
        sort (all(a[i]), greater<pair<int, string>>());
        if (sz(a[i]) < 3) cout << a[i][0].S << ' ' << a[i][1].S << endl;
        if (a[i][1].F == a[i][2].F) cout << "?" << endl;
        else cout << a[i][0].S << ' ' << a[i][1].S << endl;
    }

return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define str(x) (int)strlen(x)
#define all(x) x.begin(), x.end()
#define itr ::iterator
#define rt return
#define sf scanf
#define pf printf
#define bit __builtin_popcountll
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define SABR inline ll IN(){ll x=0,ch=getchar(),f=1;while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();if (ch=='-'){f=-1;ch=getchar();}while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}inline void OUT(ll x){if (x<0) putchar('-'),x=-x;if (x>=10) OUT(x/10),putchar(x%10+'0');else putchar(x+'0');}
#define PI 3.14159265358979323846264338327950288419716939937510

using namespace std;

typedef long long ll;
typedef unsigned uns;
typedef pair <int, int> pi;
typedef pair <ll, ll> pl;
typedef vector <int> vi;
typedef vector <ll> vl;

const int MX = (int) 1e6 + 17;
const int MOD = (int) 1e9 + 7;
const long long   oo = (ll) 1e18 + 7;
const int INF = (int) 999999999;
const int N = (int)1e5 + 17;
SABR

    int n, m;
    string x;
    int y, z;
    multiset <pair <int, string> > a[11111];
    multiset <pair <int, string> >itr it;
int main()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
    {
        cin >> x >> y >> z;
        a[y].insert(mp(z, x));
    }

    for (int i = 1; i <= m; i++)
    {
        string FF, SS;
        int f, s;
        it = a[i].end();
        it--;
        f = it->F;
        FF = it->S;
        it--;
        s = it->F;
        SS = it->S;
        if (f != s || sz(a[i]) < 3) cout << FF << ' ' << SS << endl;
        else cout << "?" << endl;
    }

return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define str(x) (int)strlen(x)
#define all(x) x.begin(), x.end()
#define itr ::iterator
#define rt return
#define sf scanf
#define pf printf
#define bit __builtin_popcountll
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define SABR inline ll IN(){ll x=0,ch=getchar(),f=1;while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();if (ch=='-'){f=-1;ch=getchar();}while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}inline void OUT(ll x){if (x<0) putchar('-'),x=-x;if (x>=10) OUT(x/10),putchar(x%10+'0');else putchar(x+'0');}
#define PI 3.14159265358979323846264338327950288419716939937510

using namespace std;

typedef long long ll;
typedef unsigned uns;
typedef pair <int, int> pi;
typedef pair <ll, ll> pl;
typedef vector <int> vi;
typedef vector <ll> vl;

const int MX = (int) 1e6 + 17;
const int MOD = (int) 1e9 + 7;
const long long   oo = (ll) 1e18 + 7;
const int INF = (int) 999999999;
const int N = (int)1e5 + 17;
SABR

    int n, m;
    string x;
    int y, z;
    vector <pair <int, string> > a[11111];
int main()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
    {
        cin >> x >> y >> z;
        a[y].pb(mp(z, x));
    }

    for (int i = 1; i <= m; i++)
    {
        sort (all(a[i]), greater<pair<int, string>>());
        if (sz(a[i]) < 3) cout << a[i][0].S << ' ' << a[i][1].S << endl;
        else if (a[i][1].F == a[i][2].F) cout << "?" << endl;
        else cout << a[i][0].S << ' ' << a[i][1].S << endl;
    }

return 0;
}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

bool cmp ( int a , int b )
{
    return (a>b);
}

pair <int,int > p[100009];
pair <int,int> ans[100009];

vector < vector <pair <int,string> > > v(100009);

string s[100006];

int main()
{

	/*
	freopen("free.in", "r", stdin);

	freopen("free.out", "w", stdout);
	*/
	//memset(dp, -1, sizeof (dp));
	//memset(is, 0, sizeof (is));

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

	for ( int i=1 ; i<=n; i++ )
	{
	    cin>>s[i];
	    cin>>p[i].first>>p[i].second;

	    if ( v[ p[i].first ].size()<2 ) { v[ p[i].first ].push_back( make_pair( p[i].second , s[i] ) ); }

	    else { sort ( v[ p[i].first ].rbegin() , v[ p[i].first ].rend() );

        if ( p[i].second > v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].pop_back(); v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); }
        if ( p[i].second == v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); }
	    }

	}

	for ( int j=1 ; j<=m ; j++ )
	{
	    if ( v[j].size()>2 ) { cout<<"?"<<endl; continue; }
	    for ( int i=0 ; i<v[j].size() ; i++ )
	    {
	        cout<< v[j][i].second <<" ";
	    }
	    cout<<endl;
	}

	return 0;

}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

bool cmp ( int a , int b )
{
    return (a>b);
}

pair <int,int > p[100009];
pair <int,int> ans[100009];

vector < vector <pair <int,string> > > v(100009);

string s[100006];

int main()
{

	/*
	freopen("free.in", "r", stdin);

	freopen("free.out", "w", stdout);
	*/
	//memset(dp, -1, sizeof (dp));
	//memset(is, 0, sizeof (is));

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

	for ( int i=1 ; i<=n; i++ )
	{
	    cin>>s[i];
	    cin>>p[i].first>>p[i].second;

	    if ( v[ p[i].first ].size()<2 ) { v[ p[i].first ].push_back( make_pair( p[i].second , s[i] ) ); }

	    else { sort ( v[ p[i].first ].rbegin() , v[ p[i].first ].rend() );

        if ( p[i].second > v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].pop_back(); v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); continue; }
        if ( p[i].second == v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); continue; }
	    }

	}

	for ( int j=1 ; j<=m ; j++ )
	{
	    if ( v[j].size()>2 ) { cout<<"?"<<endl; continue; }
        cout <<v[j][0].second <<" "<<v[j][1].second<<endl;
	}

	return 0;

}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

bool cmp ( int a , int b )
{
    return (a>b);
}

pair <int,int > p[100009];
pair <int,int> ans[100009];

vector < vector <pair <int,string> > > v(100009);

string s[100006];

int main()
{

	/*
	freopen("free.in", "r", stdin);

	freopen("free.out", "w", stdout);
	*/
	//memset(dp, -1, sizeof (dp));
	//memset(is, 0, sizeof (is));

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

	for ( int i=1 ; i<=n; i++ )
	{
	    cin>>s[i];
	    cin>>p[i].first>>p[i].second;

	    if ( v[ p[i].first ].size()<2 ) { v[ p[i].first ].push_back( make_pair( p[i].second , s[i] ) ); }

	    else { sort ( v[ p[i].first ].rbegin() , v[ p[i].first ].rend() );

        if ( p[i].second > v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].pop_back(); v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); continue; }
        if ( p[i].second == v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); continue; }
	    }

	}

	for ( int j=1 ; j<=m ; j++ )
	{
	    if ( v[j].size()>2 ) { cout<<"?"<<endl; continue; }
	    for ( int i=0 ; i<v[j].size() ; i++ )
	    {
	        cout<< v[j][i].second <<" ";
	    }
	    cout<<endl;
	}

	return 0;

}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

bool cmp ( int a , int b )
{
    return (a>b);
}

pair <int,int > p[100009];
pair <int,int> ans[100009];

vector < vector <pair <int,string> > > v(100009);

string s[100006];

int main()
{

	/*
	freopen("free.in", "r", stdin);

	freopen("free.out", "w", stdout);
	*/
	//memset(dp, -1, sizeof (dp));
	//memset(is, 0, sizeof (is));

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

	for ( int i=1 ; i<=n; i++ )
	{
	    cin>>s[i];
	    cin>>p[i].first>>p[i].second;

        v[ p[i].first ].push_back( make_pair( p[i].second , s[i] ) );

	}

	for ( int j=1 ; j<=m ; j++ )
	{
	    sort ( v[ p[j].first ].rbegin() , v[ p[j].first ].rend() );
	    if ( v[j].size()==2 ) {  cout <<v[j][0].second <<" "<<v[j][1].second<<endl;}
	    else if ( v[j][1].first == v[j][2].first )
	    {
	        cout<<"?"<<endl; continue;
	    }
	    else { cout <<v[j][0].second <<" "<<v[j][1].second<<endl; }

	}

	return 0;

}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

bool cmp ( int a , int b )
{
    return (a>b);
}

pair <int,int > p;
pair <int,int> ans[100009];

vector < vector <pair <int,string> > > v(100009);

string s;

int main()
{

	/*
	freopen("free.in", "r", stdin);

	freopen("free.out", "w", stdout);
	*/
	//memset(dp, -1, sizeof (dp));
	//memset(is, 0, sizeof (is));

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

	for ( int i=1 ; i<=n; i++ )
	{
	    cin>>s;
	    cin>>p.first>>p.second;

        v[ p.first ].push_back( make_pair( p.second , s ) );

	}

	for ( int i=1 ; i<=m ; i++ )
	{
	    sort ( v[ i ].rbegin() , v[ i ].rend() );
	}

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

	    //for ( int i=0 ; i<v[j].size() ; i++ ) { cout<<v[j][i].first<<" "; }
	    if ( v[j].size()==2 ) {  cout <<v[j][0].second <<" "<<v[j][1].second<<endl;}
	    else if ( v[j][1].first == v[j][2].first )
	    {
	        cout<<"?"<<endl; continue;
	    }
	    else { cout <<v[j][0].second <<" "<<v[j][1].second<<endl; }

	}

	return 0;

}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

bool cmp ( int a , int b )
{
    return (a>b);
}

pair <int,int > p[100009];
pair <int,int> ans[100009];

vector < vector <pair <int,string> > > v(100009);

string s[100006];

int main()
{

	/*
	freopen("free.in", "r", stdin);

	freopen("free.out", "w", stdout);
	*/
	//memset(dp, -1, sizeof (dp));
	//memset(is, 0, sizeof (is));

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

	for ( int i=1 ; i<=n; i++ )
	{
	    cin>>s[i];
	    cin>>p[i].first>>p[i].second;

	    if ( v[ p[i].first ].size()<2 ) { v[ p[i].first ].push_back( make_pair( p[i].second , s[i] ) ); }

	    else { sort ( v[ p[i].first ].rbegin() , v[ p[i].first ].rend() );

        if ( p[i].second > v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].pop_back(); v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); sort ( v[ p[i].first ].rbegin() , v[ p[i].first ].rend() ); continue; }
        if ( p[i].second == v[ p[i].first ][ v[ p[i].first ].size()-1 ].first ) { v[ p[i].first ].push_back ( make_pair( p[i].second , s[i]) ); continue; }
	    }

	}

	for ( int j=1 ; j<=m ; j++ )
	{
	    if ( v[j].size()>2 ) { cout<<"?"<<endl; continue; }
	    for ( int i=0 ; i<v[j].size() ; i++ )
	    {
	        cout<< v[j][i].second <<" ";
	    }
	    cout<<endl;
	}

	return 0;

}


#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>

using namespace std;

bool cmp ( int a , int b )
{
    return (a>b);
}

pair <int,int > p[100009];
pair <int,int> ans[100009];

vector < vector <pair <int,string> > > v(100009);

string s[100006];

int main()
{

	/*
	freopen("free.in", "r", stdin);

	freopen("free.out", "w", stdout);
	*/
	//memset(dp, -1, sizeof (dp));
	//memset(is, 0, sizeof (is));

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

	for ( int i=1 ; i<=n; i++ )
	{
	    cin>>s[i];
	    cin>>p[i].first>>p[i].second;

        v[ p[i].first ].push_back( make_pair( p[i].second , s[i] ) );

	}

	for ( int i=1 ; i<=m ; i++ )
	{
	    sort ( v[ p[i].first ].rbegin() , v[ p[i].first ].rend() );
	}

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

	    //for ( int i=0 ; i<v[j].size() ; i++ ) { cout<<v[j][i].first<<" "; }
	    if ( v[j].size()==2 ) {  cout <<v[j][0].second <<" "<<v[j][1].second<<endl;}
	    else if ( v[j][1].first == v[j][2].first )
	    {
	        cout<<"?"<<endl; continue;
	    }
	    else { cout <<v[j][0].second <<" "<<v[j][1].second<<endl; }

	}

	return 0;

}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        long maxmoney=(long)(Math.pow(((n-a-b)+((3+a)*a/2)+1),b) - 1);
        if (maxmoney>50000) System.out.print("-1");
        else
        {
            int j=0;
            for (int i=0; i<(n-a-b); i++)
            {
                System.out.print("1 ");
                j++;
            }
            for (int i=0; i<a; i++)
            {
                System.out.print((i+2)+" ");
                j++;
            }
            long cur = (n-a-b)+((3+a)*a/2)+1;
            for (int i=0; i<n-j; i++)
            {
                System.out.print(cur+" ");
                cur*=2;
            }
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        long maxmoney=(long)((((a+2)*(a+1))/2 +1)*Math.pow(2, b-1));
        if (maxmoney>50000) System.out.print("-1");
        else
        {
            int j=0;
            for (int i=0; i<=a; i++)
            {
                System.out.print((i+1)+" ");
                j++;
            }
            long cur = ((a+2)*(a+1))/2 + 1;
            for (int i=0; i<b; i++)
            {
                System.out.print(cur+" ");
                cur*=2;
                j++;
            }
            for (int i=j; i<n; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        long maxmoney=(long)(((a*(a+1))/2 +1)*Math.pow(2, b-1));
        if (maxmoney>50000) System.out.print("-1");
        else
        {
            int j=0;
            for (int i=0; i<a; i++)
            {
                System.out.print((i+1)+" ");
                j++;
            }
            long cur = ((a)*(a+1))/2 + 1;
            for (int i=0; i<b; i++)
            {
                System.out.print(cur+" ");
                cur*=2;
                j++;
            }
            for (int i=j; i<n; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        long maxmoney=(long)((((a+2)*(a+3))/2 +1)*Math.pow(2, b-1));
        if (maxmoney>50000) System.out.print("-1");
        else
        {
            int j=0;
            for (int i=0; i<=a; i++)
            {
                System.out.print((i+2)+" ");
                j++;
            }
            long cur = ((a+2)*(a+3))/2 + 1;
            for (int i=0; i<b; i++)
            {
                System.out.print(cur+" ");
                cur*=2;
                j++;
            }
            for (int i=j; i<n-1; i++) System.out.print("1 ");
            if (j<n-1) System.out.print("1");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        long maxmoney=(long)(Math.pow(2, b)+a);
        if (maxmoney>50000) System.out.print("-1");
        else
        {
            for (int i=0; i<=b; i++) System.out.print((long)Math.pow(2, i)+" ");
            for (int i=1; i<=a; i++) System.out.print((long)(Math.pow(2, b)+i)+" ");
            for (int i=1; i<n-a-b; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        long maxmoney=(long)(Math.pow(2, b-1)+a);
        if (maxmoney>50000) System.out.print("-1");
        else
        {
            for (int i=0; i<=b; i++) System.out.print((long)Math.pow(2, i)+" ");
            for (int i=1; i<=a; i++) System.out.print((long)(Math.pow(2, b)+i)+" ");
            for (int i=1; i<n-a-b; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        if (b == 0 && n>1)
            if (a==n-1) System.out.print("-1");
            else
            {
                for (int i=0; i<n-a; i++) System.out.print("1 ");
                for (int i=n-a; i<n; i++) System.out.print((i-n+a+2)+" ");
            }
        else
        {
            for (int i=0; i<=b; i++) System.out.print((long)Math.pow(2, i)+" ");
            for (int i=1; i<=a; i++) System.out.print((long)(Math.pow(2, b)+i)+" ");
            for (int i=1; i<n-a-b; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        long maxmoney=(long)((((a+2)*(a+3))/2 +1)*Math.pow(2, b-1));
        if (maxmoney>50000) System.out.print("-1");
        else
        {
            int j=0;
            for (int i=0; i<=a; i++)
            {
                System.out.print((i+2)+" ");
                j++;
            }
            long cur = ((a+2)*(a+3))/2 + 1;
            for (int i=0; i<b; i++)
            {
                System.out.print(cur+" ");
                cur*=2;
                j++;
            }
            for (int i=j; i<n; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        if (b == 0 && n>1)
            if (a==n-1) System.out.print("-1");
            else
            {
                for (int i=0; i<n-a; i++) System.out.print("1 ");
                for (int i=n-a; i<n; i++) System.out.print("2 ");
            }
        else
        {
            for (int i=0; i<=b; i++) System.out.print((long)Math.pow(2, i)+" ");
            for (int i=1; i<=a; i++) System.out.print((long)(Math.pow(2, b)+i)+" ");
            for (int i=1; i<n-a-b; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        if (b == 0) {
            for (int i=0; i<=a; i++) System.out.print((i+2)+" ");
            for (int i=a+1; i<n; i++) System.out.print("1 ");
        }
      //  long maxmoney=(long)(Math.pow(2, b)+a);
     //   if (maxmoney>50000) System.out.print("-1");
        else
        {
            for (int i=0; i<=b; i++) System.out.print((long)Math.pow(2, i)+" ");
            for (int i=1; i<=a; i++) System.out.print((long)(Math.pow(2, b)+i)+" ");
            for (int i=1; i<n-a-b; i++) System.out.print("1 ");
        }
    }
}


import java.util.*;

public class MainClass {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt(), a=in.nextInt(), b=in.nextInt();
        if (b == 0)
            if (a==n-1) System.out.print("-1");
            else
            {
                for (int i=0; i<n-a; i++) System.out.print("1 ");
                for (int i=n-a; i<n; i++) System.out.print("2 ");
            }
        else
        {
            for (int i=0; i<=b; i++) System.out.print((long)Math.pow(2, i)+" ");
            for (int i=1; i<=a; i++) System.out.print((long)(Math.pow(2, b)+i)+" ");
            for (int i=1; i<n-a-b; i++) System.out.print("1 ");
        }
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;

/**
 * Works good for CF
 * @author cykeltillsalu
 */
public class Terse {

	//some local config
	static boolean test = false;
	static String testDataFile = "testdata.txt";
	static String feedFile = "feed.txt";
	CompetitionType type = CompetitionType.CF;
	private static String ENDL = "\n";

	// solution
	private void solve() throws Throwable {

		String res = "";

		int n = iread()-1, a  = iread(), b = iread();
		res = "1";
		int value = 1;
		int sum = 1;
		boolean fail = false;
		for (int i = 0; i < n; i++) {
			if(b > 0){
				value = sum + 1;
				b --;
			} else if( a > 0){
				value = value +1;
				a--;
			} else {
				value = 1;
			}
			if(value > 50000){
				fail = true;
			}
			res += " " + value;
			sum += value;
		}
		if(fail){
			System.out.println("-1");
		} else {
			System.out.println(res);
		}

		out.flush();
	}

	public int iread() throws Exception {
		return Integer.parseInt(wread());
	}

	public double dread() throws Exception {
		return Double.parseDouble(wread());
	}

	public long lread() throws Exception {
		return Long.parseLong(wread());
	}

	public String wread() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) throws Throwable {

		if(test){ //run all cases from testfile:
			BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));
			String readLine = testdataReader.readLine();
			int casenr = 0;
			out: while (true) {
				BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));
				if(!readLine.equals("input")){
					break;
				}
				while (true) {
					readLine = testdataReader.readLine();
					if(readLine.equals("output")){
						break;
					}
					w.write(readLine + "\n");
				}
				w.close();
				System.out.println("Answer on case "+(++casenr)+": ");

				new Terse().solve();
				System.out.println("Expected answer: ");

				while (true) {
					readLine = testdataReader.readLine();

					if(readLine == null){
						break out;
					}
					if(readLine.equals("input")){
						break;
					}
					System.out.println(readLine);
				}
				System.out.println("----------------");
			}
			testdataReader.close();
		} else { // run on server
			new Terse().solve();
		}
		out.close();
	}

	public Terse() throws Throwable {
		if (test) {
			in = new BufferedReader(new FileReader(new File(feedFile)));
		}
	}

	InputStreamReader inp = new InputStreamReader(System.in);
	BufferedReader in = new BufferedReader(inp);
	static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	enum CompetitionType {CF, OTHER};
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;

/**
 * Works good for CF
 * @author cykeltillsalu
 */
public class Terse {

	//some local config
	static boolean test = false;
	static String testDataFile = "testdata.txt";
	static String feedFile = "feed.txt";
	CompetitionType type = CompetitionType.CF;
	private static String ENDL = "\n";

	// solution
	private void solve() throws Throwable {

		String res = "";

		int n = iread()-1, a  = iread(), b = iread();

		int value = 0;
		int sum = 0;
		if(a > 0 && b ==0){
			n--;
			res = "2 2";
			value = 2;
			sum = 4;
		} else {
			res = "1";
			value = 1;
			sum = 1;
		}

		boolean fail = false;

//		double x = Math.pow(2, 15);
//		System.out.println(x);
		for (int i = 0; i < n; i++) {
			if(b > 0){
				value = sum + 1;
				b --;
			} else if( a > 0){
				value = value +1;
				a--;
			} else {
				value = 1;
			}
			if(value > 50000){
				fail = true;
			}
			res += " " + value;
			sum += value;
		}

		if(fail || a > 0){
			System.out.println("-1");
		} else {
			System.out.println(res);
		}

		out.flush();
	}

	public int iread() throws Exception {
		return Integer.parseInt(wread());
	}

	public double dread() throws Exception {
		return Double.parseDouble(wread());
	}

	public long lread() throws Exception {
		return Long.parseLong(wread());
	}

	public String wread() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) throws Throwable {

		if(test){ //run all cases from testfile:
			BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));
			String readLine = testdataReader.readLine();
			int casenr = 0;
			out: while (true) {
				BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));
				if(!readLine.equals("input")){
					break;
				}
				while (true) {
					readLine = testdataReader.readLine();
					if(readLine.equals("output")){
						break;
					}
					w.write(readLine + "\n");
				}
				w.close();
				System.out.println("Answer on case "+(++casenr)+": ");

				new Terse().solve();
				System.out.println("Expected answer: ");

				while (true) {
					readLine = testdataReader.readLine();

					if(readLine == null){
						break out;
					}
					if(readLine.equals("input")){
						break;
					}
					System.out.println(readLine);
				}
				System.out.println("----------------");
			}
			testdataReader.close();
		} else { // run on server
			new Terse().solve();
		}
		out.close();
	}

	public Terse() throws Throwable {
		if (test) {
			in = new BufferedReader(new FileReader(new File(feedFile)));
		}
	}

	InputStreamReader inp = new InputStreamReader(System.in);
	BufferedReader in = new BufferedReader(inp);
	static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	enum CompetitionType {CF, OTHER};
}


import java.util.*;
public class Terse {
	public static void main(String[] args){
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();
		int a = reader.nextInt();
		int b = reader.nextInt();

		int[] sol = new int[n];
		Arrays.fill(sol,1);
		int curry = 1;
		int k = b==0?2:1;

		for(int i = k; i < b+1; i++){
			sol[i] = curry+1;
			curry += sol[i];
		}

		for(int i = b+1; i < a+b+1; i++){
			sol[i] = sol[i-1]+1;
		}

		if(a == n-1 && n != 1)
			sol[a+b] = 50001;

		if(sol[a+b] > 50000)
			System.out.println(-1);
		else{
			for(Integer x:sol)
				System.out.print(x + " ");
			System.out.println();
		}
	}
}


import java.util.*;
public class Terse {
	public static void main(String[] args){
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();
		int a = reader.nextInt();
		int b = reader.nextInt();

		int[] sol = new int[n];
		Arrays.fill(sol,1);
		int curry = 1;
		int k = b==0?2:1;

		for(int i = k; i < k+b; i++){
			sol[i] = curry+1;
			curry += sol[i];
		}

		k += b;

		for(int i = k; i < k+a && i < n; i++){
			sol[i] = sol[i-1]+1;
		}

		if(a == n-1 && n != 1)
			sol[a+b] = 50001;

		if(sol[a+b] > 50000)
			System.out.println(-1);
		else{
			for(Integer x:sol)
				System.out.print(x + " ");
			System.out.println();
		}
	}
}


import java.util.*;
public class Terse {
	public static void main(String[] args){
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();
		int a = reader.nextInt();
		int b = reader.nextInt();

		int[] sol = new int[n];
		Arrays.fill(sol,1);
		int curry = 1;
		int k = b==0?2:1;

		for(int i = k; i < b+1; i++){
			sol[i] = curry+1;
			curry += sol[i];
		}

		for(int i = b+1; i < a+b+1; i++){
			sol[i] = sol[i-1]+1;
		}

		if(a == n-1)
			sol[a+b] = 50001;

		if(sol[a+b] > 50000)
			System.out.println(-1);
		else{
			for(Integer x:sol)
				System.out.print(x + " ");
			System.out.println();
		}
	}
}


import java.util.*;
public class Terse {
	public static void main(String[] args){
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();
		int a = reader.nextInt();
		int b = reader.nextInt();

		int[] sol = new int[n];
		Arrays.fill(sol,1);
		int curry = 1;
		int k = b==0?2:1;

		for(int i = k; i < b+1; i++){
			sol[i] = curry+1;
			curry += sol[i];
		}

		for(int i = b+k; i < a+b+k; i++){
			sol[i] = sol[i-1]+1;
		}

		if(a == n-1 && n != 1)
			sol[a+b] = 50001;

		if(sol[a+b] > 50000)
			System.out.println(-1);
		else{
			for(Integer x:sol)
				System.out.print(x + " ");
			System.out.println();
		}
	}
}


import java.util.*;
public class Terse {
	public static void main(String[] args){
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();
		int a = reader.nextInt();
		int b = reader.nextInt();

		int[] sol = new int[n];
		sol[0] = 1;
		int curry = 1;

		for(int i = 1; i < b+1; i++){
			sol[i] = curry+1;
			curry += sol[i];
		}

		for(int i = b+1; i < a+b+1; i++){
			sol[i] = sol[i-1]+1;
		}

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

		if(sol[n-1] > 50000)
			System.out.println(-1);
		else{
			for(Integer x:sol)
				System.out.print(x + " ");
			System.out.println();
		}
	}
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author JAVA
 */
import java.util.*;
public class C_105 {

    /**
     * @param args the command line arguments
     */

    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int a = in.nextInt();
    int b = in.nextInt();
    int arr[] = new int[n];
    arr[0] = 1; int sum = 1;
    for (int i = 1; i<n; i++){
        if (b>0) {
            arr[i] = sum +1;
            b--;
        } else
            if (a>0){
                arr[i] = arr[i-1] + 1;
                a--;
            }
            else arr[i] = 1;
        if (arr[i]>50000) {System.out.println(-1); System.exit(0);}
        sum +=arr[i];
    }
    for (int i = 0; i<n; i++)
        System.out.print(arr[i] + " ");
    }

}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author JAVA
 */
import java.util.*;
public class C_105 {

    /**
     * @param args the command line arguments
     */

    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int a = in.nextInt();
    int b = in.nextInt();
    int arr[] = new int[n];
    arr[0] = 1; int sum = 1;
    for (int i = 1; i<n; i++){
        if (b>0) {
            arr[i] = sum +1;
            b--;
        } else
            if (a>0){
                if (arr[i-1]==sum) arr[i]=arr[i-1]; else {
                arr[i] = arr[i-1] + 1;
                a--;}
            }
            else arr[i] = 1;
        if (arr[i]>50000) {System.out.println(-1); System.exit(0);}
        sum +=arr[i];
    }
    if (a>0 || b>0) {System.out.println(-1); System.exit(0);}else
    for (int i = 0; i<n; i++)
        System.out.print(arr[i] + " ");
    }

}


import java.util.Scanner;
public class ttt{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int groomNum = in.nextInt()-1;
        int oh = in.nextInt();
        int wow = in.nextInt();
        if(Math.pow(2, wow)+oh>50000 || (oh==groomNum & wow==0)){
            System.out.print(-1);
            System.exit(0);
        }

        int num=1;
        System.out.print(1+" ");
        for( ; wow!=0 ; wow-- , groomNum--){
            num+=num;
            System.out.print(num+" ");
        }
        for( ; oh!=0 ; oh-- , groomNum--){
            System.out.print(++num+" ");
        }
        for( ; groomNum!=0 ; groomNum--)
            System.out.print(1+" ");
    }
}


import java.util.Scanner;
public class ttt{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int groomNum = in.nextInt();
        int oh = in.nextInt();
        int wow = in.nextInt();
        if(Math.pow(2, wow)+oh>50000 || (groomNum!=1 & oh==groomNum-1 & wow==0)){
            System.out.print(-1);
            System.exit(0);
        }

        int num=1;
        System.out.print(1+" ");
        groomNum--;
        for( ; wow!=0 ; wow-- , groomNum--){
            num+=num;
            System.out.print(num+" ");
        }
        for( ; oh!=0 ; oh-- , groomNum--){
            if(num==1) {
                System.out.print(1+" ");
                groomNum--;
            }
            System.out.print(++num+" ");
        }
        for( ; groomNum!=0 ; groomNum--)
            System.out.print(1+" ");
    }
}


import java.util.Scanner;
public class ttt{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int groomNum = in.nextInt()-1;
        int oh = in.nextInt();
        int wow = in.nextInt();
        if(Math.pow(2, wow)+oh>50000 || (groomNum!=0 & oh==groomNum & wow==0)){
            System.out.print(-1);
            System.exit(0);
        }

        int num=1;
        System.out.print(1+" ");
        for( ; wow!=0 ; wow-- , groomNum--){
            num+=num;
            System.out.print(num+" ");
        }
        for( ; oh!=0 ; oh-- , groomNum--){
            System.out.print(++num+" ");
        }
        for( ; groomNum!=0 ; groomNum--)
            System.out.print(1+" ");
    }
}


import java.util.Scanner;
public class ttt{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int groomNum = in.nextInt();
        int oh = in.nextInt();
        int wow = in.nextInt();
        if(Math.pow(2, wow)+oh>50000 || (groomNum!=1 & oh==groomNum-1 & wow==0)){
            System.out.print(-1);
            System.exit(0);
        }

        int num=1;
        System.out.print(1+" ");
        groomNum--;
        for( ; wow!=0 ; wow-- , groomNum--){
            num+=num;
            System.out.print(num+" ");
        }
        for( ; oh!=0 ; oh-- , groomNum--){
            if(num!=1) System.out.print(++num+" ");
            else{
                System.out.print(num+++" ");
                oh++;
            }
        }
        for( ; groomNum!=0 ; groomNum--)
            System.out.print(1+" ");
    }
}


import java.util.Scanner;
public class ttt{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int groomNum = in.nextInt()-1;
        int oh = in.nextInt();
        int wow = in.nextInt();
        if(Math.pow(2, wow)+oh>50000 || (groomNum!=1 & oh==groomNum & wow==0)){
            System.out.print(-1);
            System.exit(0);
        }

        int num=1;
        System.out.print(1+" ");
        for( ; wow!=0 ; wow-- , groomNum--){
            num+=num;
            System.out.print(num+" ");
        }
        for( ; oh!=0 ; oh-- , groomNum--){
            System.out.print(++num+" ");
        }
        for( ; groomNum!=0 ; groomNum--)
            System.out.print(1+" ");
    }
}


import java.util.Scanner;
public class ttt{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int groomNum = in.nextInt()-1;
        int oh = in.nextInt();
        int wow = in.nextInt();
        if(Math.pow(2, wow)+oh>50000 || (oh==groomNum-1 && wow==0)){
        	System.out.print(-1);
        	System.exit(0);
        }

        int num=1;
        System.out.print(1+" ");
        for( ; wow!=0 ; wow-- , groomNum--){
        	num+=num;
        	System.out.print(num+" ");
        }
        for( ; oh!=0 ; oh-- , groomNum--){
        	System.out.print(++num+" ");
        }
        for( ; groomNum!=0 ; groomNum--)
        	System.out.print(1+" ");
    }
}