The incidence matrix#964

The incidence matrix

1 secondo
64 megabyte
Molto facile

Vertex of a graph is called incident to edge if is one of the endpoints of edge .

Similarly, edge is called incident to vertex if one of the endpoints of is vertex .

The incidence matrix of a graph G = (V, E) is a rectangular table with rows and columns, where the entry at the intersection of the -th row and -th column is if vertex is incident to edge , and otherwise.

Given an undirected graph. Output its incidence matrix.

Input

The first line of the input file contains two integers and separated by a space — the number of vertices and edges in the graph, respectively (1 \leq N \leq 1000, 0 \leq M \leq 10000). The next lines each contain two integers u_i and v_i separated by a space (1 \leq u_i, v_i \leq N); each such line means that there is an edge in the graph between vertices u_i and v_i. The edges are numbered in the order in which they are given in the input file, starting from one.

Output

Print lines with numbers in each. The -th element in the -th row should be if vertex is incident to edge , and otherwise. Separate adjacent elements in a row with a single space.

Esempi

Esempio 1

Loading
Loading