/* http://projecteuler.net/
 *
 * Problem 99
 * Using base_exp.txt, a 22K text file containing one thousand lines with
 * a base/exponent pair on each line, determine which line number has the
 * greatest numerical value.
 *
 * Solution by Melkor (Filip Niksic, fniksic@gmail.com)
 *
 **/

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>

using namespace std;

int main() {
    // I've modified base_exp.txt: changed commas to spaces
    // for easier input.
    ifstream in("base_exp2.txt");

    int count = 0, max_line;
    long double base, exp, max = 0.0;
    while (in >> base >> exp) {
	++count;
	if (exp * logl(base) > max) {
	    max = exp * logl(base);
	    max_line = count;
	}
    }

    cout << max_line << endl;

    return 0;
}

