#include <iostream>
using namespace std;
int main()
{
int nr; //se declara variabila nr
cin >> nr; //se citeste de la tastatura val unui nr
cout <<nr%10<< endl;//se afiseaza prima cifra
nr= nr/10;
cout <<nr%10<<endl;//se afiseaza ultima cifra
return 0;
}