CF717H Pokermon League challenge

Description

Welcome to the world of Pokermon, yellow little mouse-like creatures, who absolutely love playing poker! Yeah, right… In the ensuing Pokermon League, there are $ n $ registered Pokermon trainers, and $ t $ existing trainer teams each of which belongs to one of two conferences. Since there is a lot of jealousy between trainers, there are $ e $ pairs of trainers who hate each other. Their hate is mutual, there are no identical pairs among these, and no trainer hates himself (the world of Pokermon is a joyful place!). Each trainer has a wish-list of length $ l_{i} $ of teams he’d like to join. Your task is to divide players into teams and the teams into two conferences, so that: - each trainer belongs to exactly one team; - no team is in both conferences; - total hate between conferences is at least $ e/2 $ ; - every trainer is in a team from his wish-list. Total hate between conferences is calculated as the number of pairs of trainers from teams from different conferences who hate each other.

Input Format

The first line of the input contains two integer $ n $ ( $ 4

Output Format

Print two lines. The first line should contain $ n $ numbers, specifying for each trainer the team he is in. The second line should contain $ T $ numbers, specifying the conference for each team ( $ 1 $ or $ 2 $ ).