#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  v.clear();
  int x, y;
  int neg = 0, pos = 0, lsum = 0, rsum = 0;
  int maxx = 0, minn = 0, idx1 = 0, idx2 = 0, maxi = 0, idd = 0;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (x - y >= maxx && x > y) {
      maxx = x - y;
      idx1 = i + 1;
    }
    if (y - x >= minn && y > x) {
      minn = y - x;
      idx2 = i + 1;
    }
    lsum += x;
    rsum += y;
  }
  int flg = 0;
  if (lsum + minn >= rsum + maxx) {
    cout << idx2 << endl;
  } else
    cout << idx1 << endl;
  return 0;
}
