#include <iostream>
#include <stdio.h>
#include <map>
#include <string>
#include <vector>

using namespace std;
map<string, int> fn;
vector<int>     list;
int count = 0;
//0 is the sourse point
//
void rd(){
cin>>n>>m;
if(fn.find(n) != fn.end()){
fn.insert(pair<string,int>(m,++count));
list.push_back(count);
}
if(fn.find(n) != fn.end()){
fn.insert(pair<string,int>(m,++count));
}
d[fn[n]][fn[m]]=1;
}
void rd1(){
cin>>n>>m;
if(fn.find(n) != fn.end()){
fn.insert(pair<string,int>(m,++count));
list.push_back(count);
}
if(fn.find(n) != fn.end()){
fn.insert(pair<string,int>(m,++count));
}
d[fn[n]][fn[m]]=100;
}
void readin(){
int a;
string n,m;
scanf("%d", &a);
for(int i = 1; i <= a; i++){
cin>>n;
fn.insert(pair<string,int>(n, ++count));
d[count][0]=1;
}
scanf("%d",&a);
for(int i = 1; i <= a; i++){
rd();
}
scanf("%d",&a);
for(int i = 1; i <= a; i++){
rd1();
}
}
void build(){
vector<int>::iterator iter = list.begin();
count++;
for(;iter != list.end(); iter++){
d[count][*iter] = 1;
}
}

int main(){

}
Revert "#include <iostream>"

This reverts commit 877dd723c35f4d33b2568160148cc0da95d4052f.
Revert "Revert "#include <iostream>""

This reverts commit 4068001f5af98daa9991c562212e88c1b54c7717.