console.log((args=>{
  const [[N],b] = args.trim().split('\n').map(r=>r.split(' ').map(v=>v|0));
  const a = [];
  let n = N;
  while( n ) {
    for ( let i = n-1; i >= 0; i-- ) {
      if ( b[i] !== i+1 ) continue;
      a.push( b[i] );
      b.splice(i,1);
      break;
    }
    if ( n > b.length ) n--;
    else return '-1';
  }
  return a.reverse().join`\n`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));