#include <bits/stdc++.h>
using namespace std;
int main() {
  int *a;
  int n = 0;
  int m = 0;
  int s = 0;
  int c = 0;
  cin >> n;
  a = new int[n];
  for (int i = 0; i < n; i++) {
    a[i] = 0;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> s;
    cin >> c;
    if (a[s - 1] > c) {
      a[s - 1] = c;
    }
  }
  if (a[0] == 0) {
    a[0] = 1;
  }
  for (int i = 0; i < n; i++) {
    cout << a[i];
  }
  delete[] a;
  return 0;
}
