#include<stdio.h>
int main()
{
char key;
int x,y;
scanf("%c",&key);
scanf("%d%d",&x,&y);
if(key=='w')
y=y-1;
else if(key=='s')
y=y+1;
else if(key=='a')
x=x-1;
else if(key=='d')
x=x+1;
printf("%d %d",x,y);
return 0;
}