#include #include #include #include #include using namespace std; const int maxx=1010; typedef struct Node { string book,name; bool operator<(const struct Node &x)const { if(name!=x.name) return name st; map mp; string s; node tnode; int p; while(getline(cin,s)) { if(s[0]=='E') break; p=s.find('"',1); tnode.book=s.substr(0,p+1); tnode.name=s.substr(p+5); mp.insert(make_pair(tnode.book,tnode.name)); st.insert(tnode); } set st1; while(getline(cin,s)) { if(s[0]=='E') break; if(s[0]=='S') { set::iterator it,it1; for(it=st1.begin();it!=st1.end();it++) { cout<<"Put "<book<<" "; it1=st.lower_bound(*it); if(st.empty()||it==st.begin()) cout<<"first"<book<