using System;
using System.Collections.Generic;
public class GameLeadProblem
{
static void Main()
{
int rounds = Int32.Parse(Console.ReadLine());
List<int> round_list = new List<int>();
int winner = 0;
for (int i = 0; i < rounds; i++)
{
string[] list = (Console.ReadLine()).Split();
round_list.Add(Int32.Parse(list[0]) - Int32.Parse(list[1]));
}
round_list.Sort();
if (round_list[0] < 0)
{
if ((round_list[0] * -1) > round_list[-1])
{
winner = 2;
Console.WriteLine("{0}", winner + "{0}", (round_list[0] * -1));
}
else
{
winner = 1;
Console.WriteLine("{0}", winner + "{0}", (round_list[-1]));
}
}
}
}