#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> num(n + 1, 0);
  vector<long long> v(n + 1, 0);
  if (n == 1 || m == 0) {
    cout << "0";
    return 0;
  }
  while (m--) {
    long long s, c;
    cin >> s >> c;
    if (v[s - 1] != 0 && num[s - 1] != c) {
      cout << "-1";
      return 0;
    }
    num[s - 1] = c;
    v[s - 1] = 1;
  }
  string p = "";
  if (v[0] == 0) {
    num[0] = 1;
  }
  for (long long i = 0; i < n; i++) {
    p += (num[i]) + '0';
  }
  if (p.size() != n || p[0] == '0') {
    cout << "-1";
    return 0;
  }
  cout << "p";
  return 0;
}
