/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com)
 */

#include <cstdio>
#include <cassert>
#include "optimization.h"

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

const int N = 3e5;

int bad = 0, n, m, p[N], pa[N];

int get(int i) {
  return i == p[i] ? i : (p[i] = get(p[i]));
}

int main() {
  n = readInt();
  m = readInt();
  forn(i, n)
    p[i] = i, pa[i] = -1;
  forn(i, m) {
    int a = get(readInt() - 1);
    int b = get(readInt() - 1);
    if (a == b)
      bad = 1;
    else if (a == pa[b])
      ;
    else if (pa[a] == -1 && pa[b] == -1)
      pa[a] = b, pa[b] = a;
    else if (pa[a] == -1)
      p[a] = pa[b];
    else if (pa[b] == -1)
      p[b] = pa[a];
    else
      p[a] = pa[b], p[pa[a]] = b;
    putchar(!bad ? '1' : '0');
  }
}
