include <iostream>
using namespace std;
int main() {
string str1 = "abcdefhmj";
cout << str1.substr(str1.length() - 1) << endl;
cout << str1.substr(str1.length() - 2) << endl;
cout<< str1.substr(str1.length() - 3) << endl;
cout<< str1.substr(str1.length() - 4) << endl;
cout<< str1.substr(str1.length() - 5) << endl;
return 0;
}