<>=~$";@p=glob<>; $p[$-]>$p[$b]?do{@p[$-,$b]=@p[$b,$-];push@z,$/.($-+1).$".($b+1);$--=$'}:$-++while($b=$-+$')<@p; print[1..@p]~~@p?(@z+0,@z):-1