#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T x) {
  std::cout << x << " ";
}
template <typename T>
void println(T x) {
  std::cout << x << "\n";
}
signed main(void) {
  long long n, m;
  cin >> n >> m;
  string str(m, 'a');
  for (long long i = 0; i < (m); i++) {
    long long first, second;
    cin >> first >> second;
    first -= 1;
    if (str.compare(first, 1, "a") != 0 &&
        str.compare(first, 1, to_string(second)) != 0) {
      print("-1");
      return 0;
    }
    str.replace(first, 1, to_string(second));
  }
  for (long long i = 0; i < (n); i++) {
    if (i == 0 && str.compare(i, 1, "0") == 0) {
      print("-1");
      return 0;
    }
    if (i == 0 && str.compare(i, 1, "a") == 0)
      str.replace(i, 1, "1");
    else if (str.compare(i, 1, "a") == 0)
      str.replace(i, 1, "0");
  }
  print(str);
}
