/*
 * This code is from "Algorithms in C, Third Edition,"
 * by Robert Sedgewick, Addison Wesley Longman, 1998.
 * (possibly with some small changes---check the book!)
 */
#include <stdio.h>
#include <stdlib.h>

#define VMAX 100

int main(int argc, char *argv[])
{ int i, j, V = atoi(argv[1]), 
    adj[VMAX][VMAX], M = 0;
  for (i = 0; i < V; i++)
    for (j = 0; j < V; j++) 
      adj[i][j] = 0;
  for (i = 0; i < V; i++) adj[i][i] = 1;
  while (scanf("%d %d\n", &i, &j) == 2)
    { adj[i][j] = 1; adj[j][i] = 1; M++; }
  for (i = 0; i < V; i++) {
    for (j = 0; j < V; j++) 
      printf("%d ", adj[i][j]);
    printf("\n");
  }
  printf("%d vertices and %d edges\n", V, M);
  return 0;
}
