#include <bits/stdc++.h>
using namespace std;
int abso(int n) {
  if (n >= 0)
    return n;
  else
    return -1 * n;
}
int main() {
  int n;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int arr[n][2];
  for (int i = 0; i < n; i++) {
    cin >> arr[i][0] >> arr[i][1];
  }
  int currl = 0, currr = 0;
  for (int i = 0; i < n; i++) {
    currl += arr[i][0];
    currr += arr[i][1];
  }
  int curmax = abso(currl - currr);
  int curr = 0;
  int flag = 0;
  int index = 0;
  for (int i = 0; i < n; i++) {
    curr =
        abso((currl - arr[i][0] + arr[i][1]) - (currr - arr[i][1] + arr[i][0]));
    if (curr > curmax) {
      flag = 1;
      curmax = curr;
      index = i + 1;
    }
  }
  if (flag = 0)
    cout << -1 << endl;
  else
    cout << index << endl;
}
