#include <iostream>
#include <vector>
#include <map>
using namespace std;

template <typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec) {
    os << '{';
    for(size_t x = 0; x + 1 < vec.size(); x++) {
        os << vec.at(x) << ", ";
    }
    if(vec.size() > 0) os << vec.at(vec.size()-1);
    os << '}';
    return os;
}


int main() {
	int n, m;
	// your code goes here
	std::map<int, std::vector<int>> arr;
    while(cin>>n>>m){
        arr[n].push_back(m); //push m onto row n
    }
    
    for(auto x : arr) {
    	cout << x.first << ' ' << x.second << endl;
    }
	return 0;
}