#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 10000;
const long double pi = acos(-1);
const long long mod = 1000000007;
template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
  for (auto x : A) out << x;
  return out;
}
template <class T>
ostream &operator<<(ostream &out, set<T> &A) {
  for (auto x : A) out << x << " ";
  return out;
}
template <class T1, class T2>
T1 powr(T1 a, T2 b) {
  T1 res = 1;
  for (long long i = 1; i < b + 1; i++) res = res * a;
  return res;
}
long long roundUp(long long numToRound, long long multiple) {
  if (multiple == 0) {
    return numToRound;
  }
  long long roundDown = ((long long)(numToRound) / multiple) * multiple;
  long long roundUp = roundDown + multiple;
  long long roundCalc = roundUp;
  return (roundCalc);
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long flag = 1;
  vector<long long> k(n + 1, 0);
  vector<long long> l(n);
  while (m--) {
    long long a, b;
    cin >> a >> b;
    if (k[a] >= 1 && l[a - 1] == b) {
      l[a - 1] = b;
    } else {
      k[a]++;
      l[a - 1] = b;
    }
  }
  if (l[0] == 0) {
    flag = 0;
  }
  for (long long i = 0; i < n + 1; i++) {
    if (k[i] > 1) {
      flag = 0;
      break;
    }
  }
  if (flag == 0)
    cout << -1;
  else {
    cout << l << endl;
  }
}
