Răspuns:
Explicație:
#include <iostream>
using namespace std;
int main()
{
int n, baiat, fata, gradmin, g, i, np;
cin >> n;
cin >> baiat >> fata;
g=baiat-fata; if (g<0) g*=-1;
gradmin=g; np=1;
for (i=2; i<=n; ++i)
{
cin >> baiat >> fata;
g=baiat-fata; if (g<0) g*=-1;
if (g<=gradmin) { gradmin=g; np=i; }
}
cout << np << endl;
return 0;
}