Under construction

Still being built. Things may change

Badminton

Interview

Time limit1sMemory limit1024 MB

Summary
Pair Bitai's six players into three teams to maximize the wins among nine pair-versus-pair matches against Baitai's three pair strengths.
Level

Easy3 of 10

Topics
Brute force, Implementation
Solved
No attempts yet

Statement

The badminton team Bitai from Bitlandija plays the final match against the team Baitai from Baitlandija. Since Baitai plays at home, they announced their lineup in advance.

Each team consists of three pairs of players.

  • Each player has a strength index sis_i.
  • If players ii and jj form a pair, the pair's strength index is P=si+sjP = s_i + s_j.
  • When two pairs play each other, the pair with the higher strength index wins.

Using the announced information, Bitai wants to form a team that beats Baitai. Each pair of Bitai plays each pair of Baitai once, for a total of 9 matches. Can Bitai win?

Form 3 pairs from the Bitai players so that they win as many matches as possible. The data is such that ties are impossible.

Input

The first line contains the pair strength indices B1B_1, B2B_2, B3B_3 of the Baitai pairs. The next six lines contain the strength indices SiS_i of the individual Bitai players, one per line.

Output

Print an integer MM, the number of matches Bitai can win. On the next three lines, print any valid team arrangement that achieves this best result. Each line lists the strength indices of the two players in one pair.

Constraints

1≤Bi≤200 0001 \le B_i \le 200\,000

1≤Si≤100 0001 \le S_i \le 100\,000

Examples1

  1. Example 1

    Input
    20 7 15
    12
    9
    10
    4
    7
    2
    
    Expected output
    5
    12 10
    9 7
    4 2