#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    vector<int> S(N+1, -1);
    int tmp;
    int tmps;
    int flag=0;//-1を出力しなきゃ！
    //暫定の桁ごとの数字
    for (int i = 1; i <=M; i++) {
        cin >> tmp;
        cin >> tmps;
        if (S[tmp]!=-1 and S[tmp] != tmps){
            flag = 1;
        }
        S[tmp] = tmps;
    }
    int zf = 0;//0フラグ
    int pzf = 0;
    for (int i = 1; i <=N; i++) {
      pzf = 0 ;
      if (S[i] == 0) {
       /* if (zf == 0) {
           S[i] =1;
           zf = 1;
        }
        */
        flag =1;
      } else {
          pzf = zf;
          zf=1;
      }
      if (S[i] == -1) {
        if (pzf == 0) {
              S[i] = 1;
              zf=0
        } else {
          S[i] = 0;
        }
      }
    }
    if (flag == 0){
        for (int i = 1; i <= N; i++) {
            cout << S[i];
        }
    } else {
        cout << -1;
    }
    return 0;
}