#include <bits/stdc++.h>
using namespace std;
int main(#include <bits/stdc++.h>
using namespace std;

int n,m,c1[6],s1[4];
string s,c="02345";
map<int, int>mp;
bool b;

int main() {
  cin >> n >> m;

  for (int i=0; i<m; i++) {
    cin >> s1[i] >> c1[i];
    mp[s1[i]]++;
  }
  
  for (int i=0; i<m; i++) {
    if (mp[s1[i]]>1)
      b=1;
  }

  for (int i=0; i<m; i++){
    c[s1[i]]=c1[i];
  }

  if (c[0]=='0' || b==1)
    cout << "-1" << endl;
  else{
    for (int i=0; i<n; i++)
      cout << c[i] << endl;
  }
}