#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;
bool dfs(int pupil, vector<int> &assignments, const vector<vector<int>> &friends, int team);
int main()
{
int n, m;
cin >> n >> m;
vector<vector<int>> friends(n + 1);
for (int i = 0; i < m; i++)
{
int a, b;
cin >> a >> b;
friends[a].push_back(b);
friends[b].push_back(a);
}
vector<int> assignments(n + 1, 0);
for (int pupil = 1; pupil <= n; pupil++)
{
if (assignments[pupil] == 0)
{
bool result = dfs(pupil, assignments, friends, 1);
if (result == false)
{
cout << "IMPOSSIBLE\n";
return;
}
}
}
for (int as : assignments)
{
if (as != 0)
{
cout << as << " ";
}
}
cout << "\n";
}
bool dfs(int pupil, vector<int> &assignment, const vector<vector<int>> &friends, int team)
{
int other_team = team == 1 ? 2 : 1;
assignment[pupil] = team;
for (int f : friends[pupil])
{
int assignment_friend = assignment[f];
if (assignment_friend == team)
{
return false;
}
else if (assignment_friend == 0)
{
dfs(f, assignment, friends, other_team);
}
}
return true;
}