Under construction

Still being built. Things may change

Minimums on the Edges

Time limit4sMemory limit512 MB

Summary
Given a graph with up to 18 vertices and s tokens, place the tokens on vertices to maximize the sum of min(a_u, a_v) over all edges, and print the counts.
Level

Hard8 of 10

Topics
Brute force, Bit manipulation, Graph
Solved
No attempts yet

Statement

You are given an undirected graph with nn vertices and mm edges. Each vertex can hold several tokens. Initially, no vertex has any tokens, but you have ss tokens that you can distribute among the vertices.

The capacity of each edge is the smaller of the numbers of tokens on its two endpoints. Your goal is to maximize the sum of the capacities of all edges.

Input

The first line contains three integers nn, mm, and ss: the number of vertices, the number of edges, and the number of tokens to distribute (1≤n≤181 \le n \le 18, 0≤m≤100 0000 \le m \le 100\,000, 0≤s≤1000 \le s \le 100).

Each of the next mm lines describes one edge with two integers uu and vv, the indices of the vertices it connects (1≤u,v≤n1 \le u, v \le n).

The graph has no self-loops. However, there can be multiple edges between the same pair of vertices.

Output

Print nn numbers a1,a2,…,ana_1, a_2, \ldots, a_n (0≤ai≤s0 \le a_i \le s), where aia_i is the number of tokens on vertex ii. The printed numbers must sum to ss. The sum of the capacities of all edges must be as large as possible.

If several optimal answers exist, print any of them.

Hint

In the first sample, the sum of capacities is min⁡(2,2)+min⁡(2,2)+min⁡(2,2)+min⁡(2,0)=2+2+2+0=6\min(2, 2) + \min(2, 2) + \min(2, 2) + \min(2, 0) = 2 + 2 + 2 + 0 = 6.

In the second sample, the sum of capacities is min⁡(3,2)+min⁡(3,2)+min⁡(3,2)+min⁡(3,2)+min⁡(3,2)+min⁡(2,2)+min⁡(2,2)=2+2+2+2+2+2+2=14\min(3, 2) + \min(3, 2) + \min(3, 2) + \min(3, 2) + \min(3, 2) + \min(2, 2) + \min(2, 2) = 2 + 2 + 2 + 2 + 2 + 2 + 2 = 14.

Examples2

  1. Example 1

    Input
    4 4 6
    1 2
    2 3
    3 1
    1 4
    
    Expected output
    2 2 2 0
    
  2. Example 2

    Input
    3 7 7
    1 2
    1 2
    1 2
    1 3
    1 3
    2 3
    2 3
    
    Expected output
    3 2 2