//AC
#include <iostream> #include <cstdlib> #include <stdio.h> #include <algorithm> #include <math.h> #include <string.h> #include <queue> #include <stack> #include <vector> #include <map> #include <set> typedef long long ll; using namespace std; struct stu{ int sex; char name[10]; }; int main(){ int n; struct stu student[52]; scanf("%d",&n); int vis[52]={0}; for (int i=1; i<=n; i++) { scanf("%d%s",&student[i].sex,student[i].name); } for (int i=1; i<=n/2; i++) { cout<<student[i].name<<" "; for (int j=n; n/2<j; j--) { if(vis[j]==0&&student[i].sex!=student[j].sex){ cout<<student[j].name<<endl; vis[j]=1; break; } } } return 0; }