You are playing with some cards.
Each card has
symbols on it.
There are
different possible symbols, so we will represent each card as a sequence of
integers, each between
and
(inclusive).
You have a deck of
cards, where every combination of symbols appears on exactly one card.
You are playing a game where you try to arrange the cards into sets.
A set of cards consists of
cards, such that across these cards, all
symbols appear in each of the
positions exactly once.
Your goal is to split the deck into sets such that each card is in exactly one set.
Your friend has already started playing and has already made one valid set.
Write a program to arrange the remaining
cards into valid, non-overlapping sets.
Constraints


The initial set is guaranteed to be valid.
Input Specification
The first line contains two integers,
and
.
The next
lines contain
integers each, representing the cards your friend already picked.
Output Specification
You should output descriptions of the
sets you will make.
The description of each set should have
lines containing
integers each, representing the cards in that particular set.
You may output any valid way of partitioning the remaining cards into valid sets, and you may output the cards in a specific set in any order.
Sample Input
Copy
2 3
1 3
2 2
3 1
Sample Output
Copy
3 2
1 1
2 3
3 3
2 1
1 2
Explanation for Sample
The three sets are
Copy
1 3
2 2
3 1
(which was given in the input),
Copy
3 2
1 1
2 3
and
Copy
3 3
2 1
1 2
Note how all 9 cards each appeared exactly once.
Comments