#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long long MAX = 9000000000000000000;
const long long MIN = -9000000000000000000;
const long double DMAX = 4500;
const long double DMIN = -4500;
const long long MOD = 100000007;
template <typename T>
T Sum(vector<T> n, long long a = 0, long long b = 0) {
  if (b == 0) {
    return (accumulate(n.begin() + a, n.end(), 0));
  } else {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}
template <>
long double Sum(vector<long double> n, long long a, long long b) {
  if (b == 0) {
    return (accumulate(n.begin() + a, n.end(), 0.));
  } else {
    return (accumulate(n.begin() + a, n.begin() + b, 0.));
  }
}
template <typename T>
void Sort(T &n, long long a = 0, long long b = 0) {
  if (b == 0) {
    return (sort(n.begin() + a, n.end()));
  } else {
    return (sort(n.begin() + a, n.begin() + b));
  }
}
template <typename T>
void Down(T &n, long long a = 0, long long b = 0) {
  if (b == 0) {
    return (sort(n.begin() + a, n.end(), greater<long long>()));
  } else {
    return (sort(n.begin() + a, n.begin() + b, greater<long long>()));
  }
}
template <typename T>
void Reve(T &n, long long a = 0, long long b = 0) {
  if (b == 0) {
    return (reverse(n.begin() + a, n.end()));
  } else {
    return (reverse(n.begin() + a, n.begin() + b));
  }
}
template <typename T, typename U>
void Copy(T &n, U &m, long long a = 0, long long b = 0) {
  copy(n.begin(), n.end(), m.begin());
}
template <typename T>
void V(T &n) {
  for (long long i = 0; i < n.size(); i++) {
    cin >> n[i];
  }
}
template <typename T, typename U>
void V2(T &n, U &m) {
  for (long long i = 0; i < n.size(); i++) {
    cin >> n[i] >> m[i];
  }
}
template <typename T, typename U, typename W>
void V3(T &n, U &m, W &p) {
  for (long long i = 0; i < n.size(); i++) {
    cin >> n[i] >> m[i] >> p[i];
  }
}
template <typename T>
void VV(T &n, long long size) {
  for (long long i = 0; i < n.size(); i++) {
    for (long long j = 0; j < size; j++) {
      cin >> n[i][j];
    }
  }
}
template <typename T>
void Rool(T &n, T &m, long long height, long long width) {
  for (long long i = 0; i < width; i++) {
    for (long long j = 0; j < height; j++) {
      m[i][j] = n[height - j - 1][i];
    }
  }
}
void fYn(bool a) {
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}
long long C45(long double n) { return round(n); }
long long Up(long long a, long long b) { return ((a + b - 1) / b); }
bool IsPrime(long long num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (long long i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) return false;
  }
  return true;
}
long long GetDigit(long long num) { return log10(num) + 1; }
long long KSum(long long n) {
  long long sum = 0;
  if (n < 0) return 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
bool KReve(long long n) {
  long long reverse = 0;
  long long remaind;
  long long tmp = n;
  while (tmp != 0) {
    remaind = tmp % 10;
    reverse = reverse * 10 + remaind;
    tmp /= 10;
  }
  if (reverse == n)
    return true;
  else
    return false;
}
vector<long long> enum_div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ngcd(vector<long long> a) {
  long long res;
  res = a[0];
  for (long long i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long nlcm(vector<long long> numbers) {
  long long res;
  res = numbers[0];
  for (long long i = 1; i < numbers.size(); i++) {
    res = lcm(res, numbers[i]);
  }
  return res;
}
long long modpow(long long x, long long n, long long mod = MAX) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod) {
  long long b = mod, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= mod;
  if (u < 0) u += mod;
  return u;
}
long long factorial(long long n, long long mod = MOD) {
  if (n > 0)
    return n * factorial(n - 1) % mod;
  else
    return 1;
}
long long perm(long long a, long long b) {
  return (factorial(a) / factorial(a - b));
}
long long comb(long long a, long long b) {
  return (factorial(a) / (factorial(a - b) * factorial(b)));
}
long long fac[500000], finv[500000], inv[500000];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long cnt = 0;
long long func(vector<char> list, long long len, long long index) {
  if (index >= len - 2) {
    for (long long i = 0; i < len; i++) cout << list[i];
    cout << endl;
    swap(list[len - 1], list[len - 2]);
    for (long long i = 0; i < len; i++) cout << list[i];
    cout << endl;
    cnt += 2;
    return 0;
  }
  vector<char> list2 = list;
  func(list, len, index + 1);
  for (long long i = index + 1; i < len; i++) {
    swap(list[index], list[i]);
    func(list, len, index + 1);
    list = list2;
  }
  return 0;
}
long long sigma(long long n, long long m) {
  return ((n + m) * (m - n + 1) * 0.5);
}
long double hope(long double a) { return (sigma(1, a) / a); }
long long modfactorial(long long n, long long mod = MOD) {
  long long ans = 1;
  for (long long i = 0; i < (n); ++i) {
    ans *= (i + 1);
    ans %= mod;
  }
  return ans;
}
void Main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> s(m), c(m);
  V2(s, c);
  vector<long long> ans(n, -1);
  for (long long i = 0; i < m; i++) {
    if (s[i] == 1 && ans[0] == -1) {
      ans[0] = c[i];
    } else if (s[i] == 1 && ans[0] != c[i]) {
      fYn(0);
    }
    if (s[i] == 2 && ans[1] == -1) {
      ans[1] = c[i];
    } else if (s[i] == 2 && ans[1] != c[i]) {
      fYn(0);
    }
    if (s[i] == 3 && ans[2] == -1) {
      ans[2] = c[i];
    } else if (s[i] == 3 && ans[2] != c[i]) {
      fYn(0);
    }
  }
  for (long long i = 0; i < n; i++) {
    if (ans[i] == -1) {
      if (i == 0 && n != 1) {
        ans[i] = 1;
      } else {
        ans[i] = 0;
      }
    }
    cout << ans[i];
  }
  cout << ("") << endl;
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}
