//#define _CRT_SECURE_NO_DEPRECATE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#define all(v) v.begin(),v.end() using namespace std; //typedef long long ll; //typedef unsigned long long ull; //typedef long double ld; //const ld epsylon = 1e-9; //typedef unsigned int ui; //inline long double get_time(){ // return (long double)clock()/CLOCKS_PER_SEC; //}; //ld start_time,end_time; int n, m; pair first[513], second[513]; map all; int main() { freopen("exam.in","r",stdin); freopen("exam.out","w",stdout); //start_time = get_time(); //program scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) { scanf("%d %d", &first[i].first, &first[i].second); all.insert(make_pair(first[i].first, first[i].second)); } for (int i = 0; i < m; i++) { scanf("%d %d", &second[i].first, &second[i].second); if (all.count(second[i].first)) all[second[i].first] += second[i].second; else { all.insert(make_pair(second[i].first, second[i].second)); } } for (map::iterator it = all.begin(); it != all.end(); ++it) { if ((*it).second > 119) cout<first<