#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s(m);
  vector<int> c(m);
  for (int i = 0; i < (int)(m); i++) cin >> s.at(i) >> c.at(i);
  vector<int> a(m);
  vector<int> k(m);
  int flagA = 0;
  int flagB = 0;
  int flagC = 0;
  for (int i = 0; i < m - 1; i++) {
    for (int j = 1 + i; j < m; j++) {
      if (s.at(i) == s.at(j) && c.at(i) != c.at(j)) flagB = 1;
    }
  }
  if (flagB == 1)
    cout << "-1" << endl;
  else {
    for (int i = 0; i < m; i++) {
      k.at(s.at(i) - 1) = c.at(i);
    }
    for (int i = 0; i < n; i++) {
    }
    cout << endl;
  }
}
