#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define endl '\n'
#define pq priority_queue
using namespace std;
typedef pair<int,int> pii;
void solve(){
int n;
cin >> n;
vector<array<int,3>>p(n);
set<int>s;
for(int i = 1;i <= n;i ++)
s.insert(i);
for(int i = 0;i < n;i ++){
int l, r;
cin >> l >> r;
p[i] = {r, l, i};
}
vector<int>ans(n);
sort(p.begin(), p.end());
for(auto [r, l, id] : p){
auto it = s.lower_bound(l);
if(it == s.end() || *it > l){
cout << -1 << endl;
return;
}
ans[id] = *it;
s.erase(it);
}
for(int i = 0;i < n;i ++)
cout << ans << ' ';
cout << endl;
}
signed main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t = 1;
while(t--)
{
solve();
}
return 0;
}