#include <fstream>
using namespace std;
int main(){
fstream in("loverfinding.in", ios::in), out("loverfinding.out", ios::out);
long n, x, y, xt, yt, times = 0;
in >> n >> x >> y >> xt >> yt;
if(x == xt && y == yt) goto succret;
for(long i = 0; i < n; ++i){
long dx, dy;
in >> dx >> dy;
x += dx, y += dy;
++times;
if(x == xt && y == yt) goto succret;
}
goto errorret;
errorret:
out << "SingleDogMZX" << endl;
return 0;
succret:
out << times << endl;
return 0;
}