Under construction

Still being built. Things may change

Parts Management with Hyundai Mobis

Time limit1sMemory limit1024 MB

Summary
Split N parts into the fewest groups whose total size stays within A and total weight within B, then print a fixed message for each run.
Level

Easy3 of 10

Topics
Implementation, Greedy
Solved
No attempts yet

Problem

Hyundai Mobis is a global top-7 auto parts maker with annual revenue above 36 trillion won.

Founded in 1977, Hyundai Mobis focuses its capabilities on future mobility fields such as autonomous driving, connectivity, and electrification, under the vision 'Innovation for Humanity, Mobility for Tomorrow'.

Hyundai Mobis leads development of core automotive parts such as electrification, braking, chassis, suspension, steering, airbags, lamps, and electronics. It has strong expertise in sensors, ECU sensor fusion, and software for safety control.

At the start of the 2022 school year, Hyundai Mobis gave members of the Yonsei University programming club Mologorithm a chance to tour the company and get hands-on field experience. The club members then visited the Hyundai Mobis headquarters.

Hyundai Mobis makes auto parts and manages them by dividing them into several groups. To prevent accidents, the sum of sizes of the parts in each group must not exceed AA, and the sum of weights must not exceed BB. To manage parts efficiently, the company also wants to minimize the number of groups. As part of the field experience, Hyundai Mobis asks club members to build this "Material Management Program." For club members without field experience, Hyundai Mobis provides in advance the "Classification Program" that goes into the Material Management Program.

Given the size and weight of each part to classify, build the "Material Management Program."

Input

The first line contains a positive integer TT, the number of material management runs. (1≤T≤101 \le T \le 10)

Each run is given as follows.

  • The first line contains a positive integer NN, the number of parts. (1≤N≤10 0001 \le N \le 10\,000)
  • The second line contains positive integers AA and BB, the size limit and weight limit of each group. (1≤A,B≤1091 \le A, B \le 10^9)
  • The next NN lines each contain positive integers uiu_i and viv_i, the size and weight of the ii-th part. (1≤ui≤A1 \le u_i \le A, 1≤vi≤B1 \le v_i \le B)

Output

For each run, print the following.

  • The first line prints Material Management x. Here x is the number of the process, starting at 1 and increasing by 1.
  • The second line prints Classification ---- End!, which marks the completion of the Classification Program developed by Hyundai Mobis.

Examples1

  1. Example 1

    Input
    2
    3
    4 5
    2 3
    1 4
    3 1
    2
    2 2
    2 2
    2 2
    
    Expected output
    Material Management 1
    Classification ---- End!
    Material Management 2
    Classification ---- End!