#include <bits/stdc++.h>
using namespace std;
void printVector(const vector<int>& vec) {
  for (int value : vec) {
    cout << value << " ";
  }
  cout << endl;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s(m, 0);
  vector<int> c(m, 0);
  vector<string> ans(m, "0");
  for (int i = 0; i < m; i++) cin >> s[i] >> c[i];
  for (int i = 0; i < m; i++) {
    ans[s[i] - 1] = to_string(c[i]);
  }
  if (m < n)
    cout << "-1" << endl;
  else {
    for (auto i : ans) {
      cout << i << endl;
    }
  }
  return 0;
}
