Under construction

Still being built. Things may change

Graphs and Graphs

Time limit1sMemory limit1024 MB

Summary
Given a line Ax + By = C, add a directed edge from x to y for every integer point (x, y) with 1 to 10 on the line, then print each vertex's out-neighbors.
Level

Easy2 of 10

Topics
Brute force, Implementation, Math
Solved
No attempts yet

Problem

Dagwak heard in his informatics class that graphs would be covered, so he decided to study ahead. But he ended up studying graphs on the coordinate plane instead of graph theory.

Dagwak drew the line given by the equation Ax+By=CAx + By = C on the coordinate plane. He wants to turn this graph into a directed graph made of vertices and edges. There are 10 vertices, numbered 1 through 10 with distinct integers. Initially the graph has no edges. For two integers xx and yy between 1 and 10 inclusive, if the line passes through the point (x,y)(x, y), Dagwak adds exactly one edge from vertex xx to vertex yy. An edge whose start and end are the same vertex can also be added.

Print the new graph that Dagwak builds through this process.

Input

The first line contains the coefficients AA, BB, and CC of the equation Ax+By=CAx+By=C, separated by spaces. (−100000≤A,B,C≤100000)(-100000 \le A,B,C \le 100000)

AA, BB, and CC are integers, and AA and BB are never both 0.

Output

Print 10 lines. On the i-th line, print the numbers of the vertices that can be reached from vertex i by passing through exactly one edge, in ascending order, separated by spaces. If there are none, print 0 instead.

Examples2

  1. Example 1

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

    Input
    2 0 4
    
    Expected output
    0
    1 2 3 4 5 6 7 8 9 10
    0
    0
    0
    0
    0
    0
    0
    0