
#include <iostream>
using namespace std;

int main() {
	string front;
	string back;
	string name;
	int number;
	
	cout << "How many names will u enter ?\n";
	cin >> number;

	cout << "Enter the names\n";
	cin >> name;
	
	front = name;
	back = name ;
	
	for (int i = 1 ; i < number ; i++)
	{
		cin >> name;
		
	
		if ( name < front)
		{
			front = name;
			
		}
		else if ( name > back )
		{
			back = name;
			
		}
		
	}
	
	cout << "front is " << front << endl;
	cout << "back is " << back << endl;

	return 0;
}