#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int c[200005];

int main(){
  int n;
  cin >> n;
  int ans=0;
  REP(i,n){
    int p;
    cin >> p;
    c[p]++;
    while(c[ans]!=0)ans++;
    cout << ans << endl;
  }
}


#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define int ll
#define each(i, a) for (auto &&i : (a))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using P = pair<int, int>;
using vp = vector<P>;
using int128 = __int128_t;//cin coutはできない
template <class T>
using greater_queue = priority_queue<T, vector<T>, greater<T>>;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a / gcd(a, b) * b;};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template <class T>
void CVEC(const T &v) {
	int c = v.size() - 1;
	for (int i = 0; i < c; i++) cout << v[i] << ' ';
	if (c > -1) cout << v[c];
	cout << '\n';
}

#pragma endregion header

int XMAX = 10000;
int YMAX = 10000;


struct Rectangle{
	int a, b, c, d;
};

struct Point{
	int id, x, y, r;
	bool operator<( const Point& right ) const {
        return x == right.x ? y < right.y : x < right.x;
    }
};

void COUT(Rectangle	x){
	cout << x.a << " " << x.b << " " << x.c << " " << x.d << endl;
}

int n; 
vector<int> area(n, 0);

signed main(){
    cin >> n;
	vector<Point> Ps;
	map<int, Rectangle> ans;
	rep(i,n){
		int x, y, r; cin >> x >> y >> r;
		Ps.push_back({i, x, y, r});
	}
	sort(ALL(Ps));
	/*
	rep(i,n){
		int a = Ps[i].x;//x
		int b = Ps[i].y;//y
		int r = Ps[i].r;
		cout << a << " " << b << " " << r << endl;
	}
	*/
	vector<vector<bool>> occupied(XMAX/100, vector<bool>(YMAX/100, 0));
	vector<bool> used(n, 0);

	for(int i = 0; i < XMAX/100; i++){
		for(int j = 0; j < YMAX/100; j++){
			for(int k = 0; k < n; k++){
				int x = Ps[k].x;
				int y = Ps[k].y;
				int id = Ps[k].id;
				if(i * 100 <= x && x < (i + 1) * 100 && j * 100 <= y && y < (j + 1) * 100){
					ans[id] = {i * 100, j * 100, (i + 1) * 100, (j + 1) * 100};
					used[id] = 1;
					occupied[i][j] = 1;
					break;
				}
			}
		}
	}
	for(int id = 0; id < n; id++){
		if(!used[id]){
			bool flag = false;
			for(int i = 0; i < 100; i++){
				for(int j = 0; j < 100; j++){
					if(!occupied[i][j]){
						ans[id] = {i * 100, j * 100, (i + 1) * 100, (j + 1) * 100};
						occupied[i][j] = 1;
						flag = true;
						break;
					}
				}
				if(flag)break;
			}
		}
	}
	
	rep(i,n){
		COUT(ans[i]);
	}
}