#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 LL long long

#define MAX_H 10000
#define MAX_W 10000

int n;
int x[200],y[200],r[200];
int a[200],b[200],c[200],d[200];

std::mt19937 mt;
std::random_device rnd;

struct Del {
  int i;
  char dir;// U D L R
};

void init(){
  REP(i,n){
    a[i]=x[i];
    c[i]=x[i]+1;
    b[i]=y[i];
    d[i]=y[i]+1;
  }
}

void flush(){
  REP(i,n)cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<" "<<d[i]<<endl;
}

LL score(){
  double ret = 0.0;
  REP(i,n){
    LL s = (c[i]-a[i])*(d[i]-b[i]);
    double rat = (double)min(s,(LL)r[i])/(double)max(s,(LL)r[i]);
    ret+=1-(1-rat)*(1-rat);
  }
  return (LL)(ret*1e9/n);
}

/* control functions finish */

/* util functions start */

bool is_collide_two_interval(int a_,int b_,int c_, int d_){
  return (a_<=c_ && c_<b_) || (c_<=a_ && a_<d_);
}

bool is_collide_two_ad(int i,int j){
  if(i==j)return true;
  return is_collide_two_interval(a[i],c[i],a[j],c[j]) && is_collide_two_interval(b[i],d[i],b[j],d[j]);
}

bool is_collide_any_ad(int i){
  bool ret = false;
  REP(j,n){
    if(i==j)continue;
    ret = ret || is_collide_two_ad(i,j);
  }
  return ret;
}

int area(int a_,int b_,int c_, int d_){
  return (c_-a_)*(d_-b_);
}

bool is_over_area(int i){
  return area(a[i],b[i],c[i],d[i]) > r[i];
}

Del generate_del(){
  int i = mt()%n;
  int dir_i=mt()%4;
  switch(dir_i){
    case 0:
      return Del{i,'U'};
    case 1:
      return Del{i,'D'};
    case 2:
      return Del{i,'L'};
    case 3:
      return Del{i,'R'};
  }
}

bool redo_del(Del del){
  int i = del.i;
  switch(del.dir){
    case 'U':
      if(b[i]==0)return false;
      b[i]--;
      return true;
    case 'D':
      if(d[i]==MAX_H)return false;
      d[i]++;
      return true;
    case 'L':
      if(a[i]==0)return false;
      a[i]--;
      return true;
    case 'R':
      if(c[i]==MAX_W)return false;
      c[i]++;
      return true;
  }
}

void undo_del(Del del){
  int i = del.i;
  switch(del.dir){
    case 'U':
      b[i]++;
      return;
    case 'D':
      d[i]--;
      return;
    case 'L':
      a[i]++;
      return;
    case 'R':
      c[i]--;
      return;
  }
}

/* util functions finish */



int main(){
  mt.seed(42); 

  cin>>n;
  REP(i,n)cin>>x[i]>>y[i]>>r[i];
  init();
  
  REP(i,3000000){
    auto del = generate_del();
    auto suc = redo_del(del);
    if(!suc){continue;}
    if(is_over_area(del.i) || is_collide_any_ad(del.i))undo_del(del);
  }

  flush();
  //cerr<<score()<<endl;
  return 0;
}

#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
//using namespace atcoder;
const int mod = 1000000007;
const int INF =1e9+1;
int main(){
    int n;cin>>n;
    vector<int> p(n);
    rep(i,n)cin>>p[i];
    int maxP=0;
    vector<bool> boo(200005,0);
    rep(i,n){
        boo[p[i]]=1;
        if(maxP==p[i]){
            for(int i=maxP+1;i<200005;i++){
                if(boo[i]==0){
                    maxP=i;
                    break;
                }
            }
        }
        
        cout<<maxP<<endl;
    }
}
