import java.io.*;

public class SecondBig
{

	static BufferedReader keyboard = new BufferedReader 
										    	(new InputStreamReader (System.in));

	public static void SecondBiggest() throws IOException
	{
		int biggest = 0, secondBiggest = 0, a;

		/*secondBiggest = Integer.parseInt(keyboard.readLine());
		biggest = Integer.parseInt(keyboard.readLine());

		if (secondBiggest > biggest)
		{
			a = secondBiggest;
			secondBiggest = biggest;
			biggest = a;
		}*/

		a = Integer.parseInt(keyboard.readLine());

		while(a >= 0)
		{
			if (a > biggest)
			{
				secondBiggest = biggest;
				biggest = a;
			}
			else if (a > secondBiggest)
			{
				secondBiggest = a;
			}
	
			a = Integer.parseInt(keyboard.readLine());
		}	

		System.out.println("The second largest integer entered " +
								"was " +  secondBiggest + ".");
	}

	public static void main(String args[]) throws IOException
	{
		System.out.println("Please enter one number at a time, ending with a "
								+ "negative number:");
	
		SecondBiggest();
	}
}