#include <iostream>
#include <cmath>
using namespace std;

int main() {
 char f1, f2;
 int s1, s2, x, y;
 cin >> f1>> s1;
 cin >>f2 >> s2;
 x = abs(f1 - f2);
 y = abs(s1 - s2);
 cout << min(x, y) << ' ' << max(x, y);
 return 0;
}
