my code passes all test cases but WA

#include

using namespace std;

int main()

{

int t,e=0,f=0,g=0;

int a=1,b=2;

cin>>t;

while(t-- >0)

{

int c,d;

cin>>c>>d;

if(c>d)

{

    e=c-d;

   if(e>f)

{

    f=e;

}

}

else

{

    g=d-c;

    if(g>f)

    {

        f=g;

    }

}

}

(e>g)?cout<<a<<" “<<e:cout<<b<<” "<<g;

return 0;

}
this is my code can you please tell me where i have made a mistake so i can improve

Hey, please provide the link to the problem you are referring to.

provide problem link