#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
#define int long long
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; i++)
cin >> nums[i];
int maxDiff = 0;
int maxS = 0, maxE = 0;
int start = 0;
bool inc = nums[0] < nums[1];
for (int i = 1; i < n; i++)
{
if (abs(nums[i] - nums[start]) > maxDiff)
{
maxS = start+1;
maxE = i+1;
maxDiff = abs(nums[i] - nums[start]);
}
bool prev = inc;
if (i < n-1 && nums[i+1] != nums[i])
inc = nums[i+1] > nums[i];
if (prev != inc)
{
start = i;
}
}
cout << maxS << " " << maxE << endl;
}