easy question:the lead game. So this is a pretty straight forward question and I have no idea why it is still giving me a wrong answer.Any help would be greatly appreciated.Thanks!

#include
using namespace std;

int max(int a,int b)
{
if (a>b)
{
return a;
}
else
{
return b;
}
}

int mod(int e,int f)
{
if (e>f)
{
int g=e-f;
return g;
}
else
{
int h=f-e;
return h;
}
}

int player(int q,int w)
{
if (q>w)
{
return 1;
}
else
{
return 2;
}
}

int main()
{
int t;
cin >> t;
int ans = 0;
int winner = 0;
while(t>0)
{
int c,d;
cin >> c;
cin >> d;
int k = mod(c,d);
int play;
play=player(c,d);
if(k>ans)
{
winner=play;
}
else{
winner = winner+0;
}
ans=max(ans,k);
t–;
}
cout << winner << " ";
cout << ans;
return 0;
}

//