#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char** argv)
{
	if (argc != 3)
	{
		cout << "This program extracts 2D points from 3D points" << endl;
		cout << "Usage: " << argv[0] << "<in-file> <out-file>" << endl;
		return 0;
	}

	ifstream fin(argv[1], ios::in);
	if (!fin.good())
	{
		cerr << "Cannot open file: " << argv[1] << endl;
		return 1;
	}
	ofstream fout(argv[2], ios::out);

	unsigned n;
	fin >> n;
	fout << n << endl;
	for (unsigned i = 0; i < n; i++)
	{
		float x,y,z;
		fin >> x >> y >> z;
		fout << x << " " << y << endl;
	}

	fin.close();
	fout.close();

	cout << "Extracted " << n << " points" << endl;

	return 0;
}
