#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, s, c;
  cin >> n >> m;
  vector<int> a(n, -1);
  bool ans = true;
  for (int i = 0; i < (int)(m); i++) {
    cin >> s >> c;
    s--;
    if (a[s] == -1)
      a[s] = c;
    else if (a[s] != c)
      ans = false;
  }
  for (int i = 0; i < (int)(n); i++)
    if (a[i] == -1) a[i] = 0;
  if (a[0] == 0 && n >= 2) ans = false;
  if (ans)
    for (auto p : a) cout << p;
  else
    cout << "testcase";
  cout << "\n";
}
