The employees of the F company have lots of ways to entertain themselves. Today they invited a famous magician who shows a trick with plastic cups and a marble.The point is to trick the spectator's attention. Initially, the spectator stands in front of a line of n plastic cups. Then the magician places a small marble under one cup and shuffles the cups. Then the spectator should guess which cup hides the marble.But the head coder of the F company isn't easy to trick. When he saw the performance, he noticed several important facts:  each cup contains a mark — a number from 1 to n; all marks on the cups are distinct;  the magician shuffles the cups in m operations, each operation looks like that: take a cup marked xi, sitting at position yi in the row of cups (the positions are numbered from left to right, starting from 1) and shift it to the very beginning of the cup row (on the first position). When the head coder came home after work he wanted to re-do the trick. Unfortunately, he didn't remember the starting or the final position of the cups. He only remembered which operations the magician performed. Help the coder: given the operations in the order they were made find at least one initial permutation of the cups that can go through the described operations in the given order. Otherwise, state that such permutation doesn't exist.

The first line contains integers n and m (1 ≤ n, m ≤ 106). Each of the next m lines contains a couple of integers. The i-th line contains integers xi, yi (1 ≤ xi, yi ≤ n) — the description of the i-th operation of the magician. Note that the operations are given in the order in which the magician made them and the coder wants to make them in the same order.

If the described permutation doesn't exist (the programmer remembered wrong operations), print -1. Otherwise, print n distinct integers, each from 1 to n: the i-th number should represent the mark on the cup that initially is in the row in position i. If there are multiple correct answers, you should print the lexicographically minimum one.

uses SysUtils,Math;
type int64=longint;
     pair=record
             left,right:int64;
          end;
     versh=record
              num,child,y,l,r:int64;
           end;
     mass=array[0..3000000] of versh;
     maxx=array[0..3000000] of longint;
     maee=array[0..3000000,1..2] of longint;
var dp:mass;x,y,j,e,z:longint;
    ch:char;
    kol,root,size,md,dd,h1,h2,res1,res2,d,c,a,b,n,k,res:int64;
    tree:mass;
    w:pair;
    i:integer;
    used,m4,ans:maxx;
    m1:maee;
const zero:pair=(left:0;right:0);
procedure calc(t:longint);
begin
   if t<>0
   then tree[t].child:=tree[tree[t].l].child+tree[tree[t].r].child+1;
end;
function split(v,num:longint):pair;
Begin
   if v=0
   then Begin
           result:=zero;
           exit;
        end;
   if tree[tree[v].l].child+1<=num
   then Begin
           result:=split(tree[v].r,num-tree[tree[v].l].child-1);
           tree[v].r:=result.left;
           result.left:=v;
        end
   else Begin
           result:=split(tree[v].l,num);
           tree[v].l:=result.right;
           result.right:=v;
        end;
   calc(v);
end;
function merge(l,r:longint):longint;
Begin
   if (r=0) or (l=0)
   then result:=l or r
   else if tree[l].y>tree[r].y
        then Begin
                result:=l;
                tree[l].r:=merge(tree[l].r,r);
             end
        else Begin
                result:=r;
                tree[r].l:=merge(l,tree[r].l);
             end;
   calc(result);
end;
function get(t,x:longint):longint;
Begin
   if x<=tree[tree[t].l].child
   then Begin
           get:=get(tree[t].l,x);
           exit;
        end
   else if x>tree[tree[t].l].child+1
        then Begin
                get:=get(tree[t].r,x-tree[tree[t].l].child-1);
                exit;
             end;
   get:=t;
end;
procedure insert(index,value:int64);
Begin
   inc(size);
   tree[size].num:=value;
   tree[size].child:=1;
   tree[size].y:=random(1000000000)+1;
   w:=split(root,index-1);
   root:=merge(w.left,size);
   root:=merge(root,w.right);
end;
procedure remove(var t:int64;index:longint);
Begin
   if index=tree[tree[t].l].child+1
   then t:=merge(tree[t].l,tree[t].r)
   else if index<=tree[tree[t].l].child
        then remove(tree[t].l,index)
        else remove(tree[t].r,index-tree[tree[t].l].child-1);
   calc(t);
end;
procedure add(var t:int64;index,delta:longint);
Begin
   if index=tree[tree[t].l].child+1
   then inc(tree[t].num,delta)
   else if index<=tree[tree[t].l].child
        then add(tree[t].l,index,delta)
        else add(tree[t].r,index-tree[tree[t].l].child-1,delta);
   calc(t);
end;
procedure doing(t:longint);
Begin
   if tree[t].l>0
   then doing(tree[t].l);
   inc(kol);
   ans[kol]:=tree[t].num;
   m4[tree[t].num]:=1;
   if tree[t].r>0
   then doing(tree[t].r);
end;
begin
 //  assign(input,'input.txt');
 //  assign(output,'output.txt');
   root:=0;
   readln(n,k);
   kol:=0;
   for i:=1 to n do
      insert(i,0);
   for i:=1 to k do
      Begin
         readln(m1[i,1],m1[i,2]);
         if (used[m1[i,1]]=1) and (m1[i,2]>kol)
         then Begin
                 writeln(-1);
                 halt(0);
              end;
         used[m1[i,1]]:=1;
         if m1[i,2]>kol
         then Begin
                 insert(1,m1[i,1]);
                 inc(kol);
              end
         else Begin
                 a:=get(root,m1[i,2]);
                 if tree[a].num<>m1[i,1]
                 then Begin
                         writeln(-1);
                         halt(0);
                      end;
                 remove(root,m1[i,2]);
                 insert(1,m1[i,1]);
              end;
      end;
   for i:=k downto 1 do
      Begin
         remove(root,1);
         insert(m1[i,2],m1[i,1]);
      end;
   kol:=0;
   doing(root);
   a:=1;
   for i:=1 to n do
      if ans[i]=0
      then for z:=a to n do
              if m4[z]=0
              then Begin
                      ans[i]:=z;
                      a:=z+1;
                      break;
                   end;
   for i:=1 to n do
      write(ans[i],' ');
end.

var
j:longint;
n,m,i,k,p,l,r,mm,u: longint;
s,id,la,pp,num,pos,e: array[0..2222222] of longint;
procedure mdf(a,b:longint);
begin
while a <= p do begin
s[a]:=s[a]+b;
a:=a or (a-1);
a:=a+1;
end;
end;
begin
read(n,m);
for i:=1 to m do read(num[i], pos[i]);
for i:=1 to n do la[i]:=0;
k:=0;
for i:=m downto 1 do
begin
if la[num[i]] = 0 then
begin
inc(k);
e[k]:=num[i];
la[num[i]]:=1;
end;
end;
for i:=1 to n do
if la[i]=0 then begin inc(k); e[k]:=i; end;
p:=1;
while p < n+m do p:=p*2;
for i:=1 to p do s[i]:=0;
for i:=m+1 to m+n do
begin
id[i]:=i-m;
mdf(i, 1);
end;
for i:=1 to m do
begin
l:=1; r:=p;
u:=0;
while l<r do
begin
mm:=(l+r) div 2;
if s[mm]+u >= pos[i] then r:=mm else
begin u:=u+s[mm]; l:=mm+1; end;
end;
mdf(l,-1);
mdf(m-i+1,1);
id[m-i+1]:=id[l];

id[l]:=0;
end;
j:=0;
for i:=1 to n+m do
if id[i] <> 0 then
begin
inc(j);
pp[id[i]]:=e[j];
end;

for i:=1 to p do s[i]:=0;
for i:=m+1 to m+n do
begin
id[i]:=pp[i-m];
mdf(i, 1);
end;
for i:=1 to m do
begin
l:=1; r:=p;
u:=0;
while l<r do
begin
mm:=(l+r) div 2;
if s[mm]+u >= pos[i] then r:=mm else
begin u:=u+s[mm]; l:=mm+1; end;
end;
mdf(l,-1);
mdf(m-i+1,1);
id[m-i+1]:=id[l];
if id[l] <> num[i] then begin writeln(-1); halt(0); end;

id[l]:=0;
end;

for i:=1 to n do write(pp[i],' ');
writeln;
end.

program cs_d;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
    PNode = ^TNode;
    TNode = record
        l, r: PNode;
        priority: Integer;
        size: Integer;
        value: Integer;
    end;

const
    MaxN = 2000000000;

var
    root, splitter, t, t1, t2, t3: PNode;
    N, M, i: Integer;
    values, list: array [0..1000000] of Integer;
    used: array [0..1000000] of Boolean;

function NewPNode: PNode;
var t : PNode;
begin
    New(t);
    t^.l := nil;
    t^.r := nil;
    t^.priority := Random(MaxN);
    t^.size := 1;
    result := t;
end;

function getSize(t: PNode): Integer;
begin
    if (t = nil) then result := 0 else result := t^.size;
end;

procedure Update(t : PNode);
begin
      t^.size := GetSize(t^.l) + GetSize(t^.r) + 1;
end;

function Split(t: PNode; key: Integer): PNode;
var z: PNode;
begin
    if (t = nil) then begin
        splitter^.l := nil;
        splitter^.r := nil;
        result := splitter;
        Exit;
    end;

    if (key <= getSize(t^.l)) then begin
        z := Split(t^.l, key);
        t^.l := z^.r;
        z^.r := t;
    end else begin
        z := Split(t^.r, key - getSize(t^.l) - 1);
        t^.r := z^.l;
        z^.l := t;
    end;
    update(t); update(z);
    result := z;
end;

function Merge(l, r: PNode): PNode;
begin
    if (l = nil) then result := r else
    if (r = nil) then result := l else
    if l^.priority > r^.priority then begin
        l^.r := Merge(l^.r, r);
        update(l);
        Result := l;
    end else begin
        r^.l := Merge(l, r^.l);
        update(r);
        result := r;
    end;
end;

procedure DeleteTree(var t: PNode);
begin
    if t^.l <> nil then DeleteTree(t^.l);
    if t^.r <> nil then DeleteTree(t^.r);
    Dispose(t);
end;

var
    pos, val, j: Integer;
    ok: Boolean;

begin
    Randomize;
    splitter := NewPNode;
    root := nil;
    ok := True;
    FillChar(values, SizeOf(values), 0);

    Readln(N, M);
    for i := 1 to N do
    begin
        t := NewPNode;
        t^.value := i;
        root := Merge(root, t);
    end;

    for i := 1 to M do
    begin
        Readln(val, pos);
        Dec(pos);
        Split(root, pos);
        t1 := splitter^.l;
        Split(splitter^.r, 1);
        t2 := splitter^.l;
        t3 := splitter^.r;

        j := t2^.value;
        if (values[j] > 0) and (values[j] <> val) then
            ok := False;
        values[j] := val;

        root := nil;
        root := Merge(root, t2);
        root := Merge(root, t1);
        root := Merge(root, t3);
    end;

    FillChar(used, SizeOf(used), False);
    for i := 1 to n do
        if (values[i] > 0) then
            if not used[values[i]] then used[values[i]] := True
            else ok := False;

    pos := 0;
    for i := 1 to n do
        if not used[i] then begin
            Inc(pos);
            list[pos] := i;
        end;
    pos := 0;
    for i := 1 to n do
        if (values[i] = 0) then begin
            Inc(pos);
            values[i] := list[pos];
        end;
    if not ok then write('-1') else
    for i := 1 to n do write(values[i], ' ');
    writeln;
    DeleteTree(root);
end.

program cs_d;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
    PNode = ^TNode;
    TNode = record
        l, r: PNode;
        priority: Integer;
        size: Integer;
        value: Integer;
    end;

const
    MaxN = 1000*1000*1000;

var
    root, splitter, t, t1, t2, t3: PNode;
    N, M, i: Integer;
    values, list: array [0..1000000] of Integer;
    used: array [0..1000000] of Boolean;

function NewPNode: PNode;
var t : PNode;
begin
    New(t);
    t^.l := nil;
    t^.r := nil;
    t^.priority := Random(MaxN);
    t^.size := 1;
    result := t;
end;

function getSize(t: PNode): Integer;
begin
    if (t = nil) then result := 0 else result := t^.size;
end;

procedure Update(t : PNode);
begin
      t^.size := GetSize(t^.l) + GetSize(t^.r) + 1;
end;

function Split(t: PNode; key: Integer): PNode;
var z: PNode;
begin
    if (t = nil) then begin
        splitter^.l := nil;
        splitter^.r := nil;
        result := splitter;
        Exit;
    end;

    if (key <= getSize(t^.l)) then begin
        z := Split(t^.l, key);
        t^.l := z^.r;
        z^.r := t;
    end else begin
        z := Split(t^.r, key - getSize(t^.l) - 1);
        t^.r := z^.l;
        z^.l := t;
    end;
    update(t); update(z);
    result := z;
end;

function Merge(l, r: PNode): PNode;
begin
    if (l = nil) then result := r else
    if (r = nil) then result := l else
    if l^.priority > r^.priority then begin
        l^.r := Merge(l^.r, r);
        update(l);
        Result := l;
    end else begin
        r^.l := Merge(l, r^.l);
        update(r);
        result := r;
    end;
end;

procedure DeleteTree(var t: PNode);
begin
    if t^.l <> nil then DeleteTree(t^.l);
    if t^.r <> nil then DeleteTree(t^.r);
    Dispose(t);
end;

var
    pos, val, j: Integer;
    ok: Boolean;

begin
    Randomize;
    splitter := NewPNode;
    root := nil;
    ok := True;
    FillChar(values, SizeOf(values), 0);

    Readln(N, M);
    for i := 1 to N do
    begin
        t := NewPNode;
        t^.value := i;
        root := Merge(root, t);
    end;

    for i := 1 to M do
    begin
        Readln(val, pos);
        Dec(pos);
        Split(root, pos);
        t1 := splitter^.l;
        Split(splitter^.r, 1);
        t2 := splitter^.l;
        t3 := splitter^.r;

        j := t2^.value;
        if (values[j] > 0) and (values[j] <> val) then
            ok := False;
        values[j] := val;

        root := nil;
        root := Merge(root, t2);
        root := Merge(root, t1);
        root := Merge(root, t3);
    end;

    FillChar(used, SizeOf(used), False);
    for i := 1 to n do
        if (values[i] > 0) then
            if not used[values[i]] then used[values[i]] := True
            else ok := False;

    pos := 0;
    for i := 1 to n do
        if not used[i] then begin
            Inc(pos);
            list[pos] := i;
        end;
    pos := 0;
    for i := 1 to n do
        if (values[i] = 0) then begin
            Inc(pos);
            values[i] := list[pos];
        end;
    if not ok then write('-1') else
    for i := 1 to n do write(values[i], ' ');
    writeln;
end.

program problem4;
uses math;

type	tTreapRec =	record
					lSon, rSon, size, prior, pos, val: longInt;
				end;

var	t: array[ 0..1000000 ] of tTreapRec;
	tw: longInt = 0;

function newNode( p, v: longInt ): longInt;
begin
	inc( tw );
	t[tw].pos := p;
	t[tw].val := v;
	t[tw].size := 1;
	t[tw].prior := random(1000000000);
	t[tw].lSon := 0;
	t[tw].rSon := 0;

	newNode := tw;
end;

procedure recalc( v: longInt );
begin
	t[v].size := t[ t[v].lSon ].size + t[ t[v].rSon ].size + 1;
end;

function merge( l, r: longInt ): longInt;
begin
	if ( min(l, r) = 0 ) then
	begin
		merge := l + r;
		exit;
	end;

	if ( t[l].prior > t[r].prior ) then
	begin
		t[l].rSon := merge( t[l].rSon, r );
		recalc( l );

		merge := l;
	end
	else
	begin
		t[r].lSon := merge( l, t[r].lSon );
		recalc( r );

		merge := r;
	end;
end;

procedure split( v, k: longInt; var l, r: longInt );
begin
	if ( v = 0 ) then
	begin
		l := 0;
		r := 0;

		exit;
	end;

	if ( t[ t[v].lSon ].size >= k ) then
	begin
		split( t[v].lSon, k, l, t[v].lSon );
		recalc( v );

		r := v;
	end
	else
	begin
		split( t[v].rSon, k - t[ t[v].lSon ].size - 1, t[v].rSon, r );
		recalc( v );

		l := v;
	end;
end;

function remove( var v: longInt; k: longInt ): longInt;
var	a, b, c: longInt;
begin
	split( v, k - 1, a, v );
	split( v, 1, b, c );

	v := merge( a, c );

	remove := b;
end;

var	n, m, i, root, x, y: longInt;
	a: array[ 1..1000000 ] of longInt;
	used: array[ 1..1000000 ] of boolean;
	bufIn, bufOut: array[ 1..1 shl 16 ] of byte;

begin
	setTextBuf( input, bufIn );
	setTextBuf( output, bufOut );

	readln( n, m );

	root := 0;
	for i := 1 to n do
		root := merge( root, newNode( i, -1 ) );

	for i := 1 to m do
	begin
		readln( x, y );

		y := remove( root, y );

		if ( t[y].val = -1 ) or ( t[y].val = x ) then
			t[y].val := x
		else
		begin
			writeln( -1 );
			halt;
		end;

		root := merge( y, root );
	end;

	fillchar( used, sizeOf(used), false );
	for i := 1 to n do
	begin
		if ( t[i].val > -1 ) and ( used[ t[i].val ] ) then
		begin
			writeln( -1 );
			halt;
		end;

		if ( t[i].val > -1 ) then
			used[ t[i].val ] := true;

		a[ t[i].pos ] := t[i].val;
	end;

	x := 1;
	for i := 1 to n do
		if ( a[i] = -1 ) then
		begin
			while ( used[x] ) do
				inc( x );

			a[i] := x;
			inc( x );
		end;

	for i := 1 to n do
		write( a[i], ' ' );

	writeln;
end.

var
j:longint;
n,m,i,k,p,l,r,mm,u: longint;
s,id,la,pp,num,pos,e: array[0..2222222] of longint;
procedure mdf(a,b:longint);
begin
while a <= p do begin
s[a]:=s[a]+b;
a:=a or (a-1);
a:=a+1;
end;
end;
begin
read(n,m);
for i:=1 to m do read(num[i], pos[i]);
for i:=1 to n do la[i]:=0;
for i:=m downto 1 do
begin
if la[num[i]] = 0 then
begin
inc(k);
e[k]:=num[i];
la[num[i]]:=1;
end;
end;
for i:=1 to n do
if la[i]=0 then begin inc(k); e[k]:=i; end;
p:=1;
while p < n+m do p:=p*2;
for i:=1 to p do s[i]:=0;
for i:=m+1 to m+n do
begin
id[i]:=i;
mdf(i, 1);
end;
for i:=1 to m do
begin
l:=1; r:=p;
u:=0;
while l<r do
begin
mm:=(l+r) div 2;
if s[mm]+u >= pos[i] then r:=mm else
begin u:=u+s[mm]; l:=mm+1; end;
end;
mdf(l,-1);
mdf(m-i+1,1);
id[m-i+1]:=id[l];

id[l]:=0;
end;
j:=0;
for i:=1 to n+m do
if id[i] <> 0 then
begin
inc(j);
pp[id[i]]:=e[j];
end;

for i:=1 to p do s[i]:=0;
for i:=m+1 to m+n do
begin
id[i]:=pp[i];
mdf(i, 1);
end;
for i:=1 to m do
begin
l:=1; r:=p;
u:=0;
while l<r do
begin
mm:=(l+r) div 2;
if s[mm]+u >= pos[i] then r:=mm else
begin u:=u+s[mm]; l:=mm+1; end;
end;
mdf(l,-1);
mdf(m-i+1,1);
id[m-i+1]:=id[l];
if id[l] <> num[i] then begin writeln(-1); halt(0); end;

id[l]:=0;
end;

for i:=1 to n do write(pp[i],' ');
writeln;
end.