#include <bits/stdc++.h>   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   int main() {     int n, m;     cin >> n >> m;     vector<vector<pair<int, int>>> mat(m, vector<pair<int, int>>(3));     set<int> white, red, blue;     for (int i = 0; i < m; i++) {       int x, y, z;       cin >> x >> y >> z;       mat[i][0].first = x;       mat[i][1].first = y;       mat[i][2].first = z;       bool xWhite = (white.find(x) != white.end());       bool xRed = (red.find(x) != red.end());       bool xBlue = (blue.find(x) != blue.end());       bool yWhite = (white.find(y) != white.end());       bool yRed = (red.find(y) != red.end());       bool yBlue = (blue.find(y) != blue.end());       bool zWhite = (white.find(z) != white.end());       bool zRed = (red.find(z) != red.end());       bool zBlue = (blue.find(z) != blue.end());       if (xWhite) {         white.insert(x);         red.insert(y);         blue.insert(z);       } else if (xRed) {         red.insert(x);         white.insert(y);         blue.insert(z);       } else if (xBlue) {         blue.insert(x);         white.insert(y);         red.insert(z);       } else if (yWhite) {         white.insert(y);         red.insert(x);         blue.insert(z);       } else if (yRed) {         red.insert(y);         white.insert(x);         blue.insert(z);       } else if (yBlue) {         blue.insert(y);         white.insert(x);         red.insert(z);       } else if (zWhite) {         white.insert(z);         red.insert(x);         blue.insert(y);       } else if (zRed) {         red.insert(z);         blue.insert(x);         white.insert(y);       } else if (zBlue) {         blue.insert(z);         red.insert(x);         white.insert(y);       } else {         debug() <<   [                  <<  x                      :                   << (x)                 <<  ]                        [                  <<  y                      :                   << (y)                 <<  ]                        [                  <<  z                      :                   << (z) <<  ]  ;         white.insert(x);         red.insert(y);         blue.insert(z);       }     }     for (int i = 1; i <= n; i++) {       if (white.find(i) != white.end()) {         cout <<  1  ;       } else if (red.find(i) != red.end()) {         cout <<  2  ;       } else {         cout <<  3  ;       }     }     cout <<   n ;   }   