#include <iostream>
#include <map>
#include <iomanip>
#include <string>
using namespace std;
template<class T>
class ID
{
private:
T id, name;
public:
ID(T t, T n) :id(t), name(n){}
void print(){
cout.setf(ios::left);
cout << setw(15) << name << " " << id << endl;
cout.unsetf(ios::left);
}
};
int main(){
typedef ID<string> id;
typedef map<int, id> M;
typedef M::value_type v_t;
M m;
m.insert(v_t(1, id("000123", "Shevchenko")));
m.insert(v_t(2, id("000124", "Pushkin")));
m.insert(v_t(3, id("000125", "Shakespeare")));
std::pair<M::iterator, bool > it;
it = m.insert(v_t(3, id("000126", "Smith")));
cout << it.first->first << endl;
it.first->second.print();
M::reverse_iterator lt = m.rbegin();
while (lt != m.rend()){
cout.setf(ios::left);
cout << setw(3) << lt->first;
lt->second.print();
lt++;
}
return 0;
}