#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream& operator>>(istream& istr, vector<T>& v) {
  for (T& x : v) istr >> x;
  return istr;
}
template <typename T, typename U>
istream& operator>>(istream& istr, pair<T, U>& p) {
  istr >> p.first >> p.second;
  return istr;
}
template <typename T>
ostream& operator<<(ostream& ostr, vector<T>& v) {
  if (!v.empty()) {
    ostr << v.front();
    for (auto itr = ++v.begin(); itr != v.end(); itr++) ostr << "" << *itr;
  }
  return ostr;
}
template <typename T, typename U>
ostream& operator<<(ostream& ostr, pair<T, U>& p) {
  ostr << p.first << ", " << p.second;
  return ostr;
}
template <typename T>
ostream& operator<<(ostream& ostr, vector<vector<T>>& vv) {
  if (!vv.empty()) {
    ostr << vv.front();
    for (auto itr = ++vv.begin(); itr != vv.end(); itr++) ostr << endl << *itr;
  }
  return ostr;
}
template <typename T, typename U>
ostream& operator<<(ostream& ostr, vector<pair<T, U>>& vp) {
  if (!vp.empty()) {
    ostr << vp.front();
    for (auto itr = ++vp.begin(); itr != vp.end(); itr++) ostr << endl << *itr;
  }
  return ostr;
}
long long pow(long long n, long long r) {
  long long ans = 1;
  for (long long i = 0; i < (r); i++) ans *= n;
  return ans;
}
int main() {
  long long n, m, ans = 0;
  cin >> n >> m;
  vector<long long> a(n, 0);
  vector<long long> z(n, 0);
  vector<long long> s(m);
  vector<long long> c(m);
  for (long long i = 0; i < (m); i++) cin >> s[i] >> c[i];
  for (long long i = 0; i < (m); i++) {
    if (c[i] == 0) {
      if (a[i] > 0) {
        cout << -1 << endl;
        return 0;
      }
      z[s[i] - 1] = 1;
    } else {
      if (a[s[i] - 1] == 0) {
        if (z[s[i] - 1] > 0) {
          cout << -1 << endl;
          return 0;
        } else {
          a[s[i] - 1] = c[i];
        }
      } else {
        if (a[s[i] - 1] != c[i]) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }
  if (n > 1 && a[0] == 0) {
    cout << -1 << endl;
    return 0;
  }
  cout << a << endl;
  return 0;
}
