#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>

using namespace std;

class Graph {
private:
public:
  int n;
  vector<string> labels;
  
  Graph(const char *filename) {
    //    cout << "Reading from file " << filename << endl;
    ifstream in(filename);
    if (! in.good()) {
      cerr << "Unable to open file " << filename << endl;
      exit(0);
    }

    char line[1000];

    // assuming first line has the # vertices
    in >> n;
    in.getline(line, 999);

    for(int i=0; i < n; i++) {
      if (! in.getline(line, 999)) {
	cerr << "Unable to finish reading file..." << endl;
	exit(0);
      }
      // store the vertex label
      labels.push_back(line);
    }
    
    /*while (in.getline(line, 999)) {
      cout << line << endl;
      }*/
    in.close();
  }

  void print() {
    cout << "n = " << n << endl;
    for(int i=0; i < n; i++)
      cout << i << ": " << labels[i] << endl;
  }
};

int main(int argc, char * argv[]) {
  if (argc < 2) {
    cerr << "Usage: ./graph1 graph_text_file.txt" << endl;
    exit(0);
  }

  Graph G(argv[1]);
  G.print();
  
  return 0;
}