#include <iostream>
using namespace std;

main()
{
  char s[1000];
  char lastline[1000];
  char penultimate[1000];
  int l;

  l = 0;
  while (!cin.fail()) {
    cin.getline(s, 1000);
    if (!cin.fail()) {
      l++;
      if (l > 1) strcpy(penultimate, lastline);
      strcpy(lastline, s);
    }
    cout << s << endl;
  }
  if (l == 0) exit(0);
  if (l == 1) {
    cout << "The last line was '" << lastline << "'" << endl;
  } else {
    cout << "The last two lines were '" << penultimate <<
        "' and '" << lastline << "'" << endl;
  }
}

