#include <iostream>
using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  switch (a) {
    case 1:
      if (b == 2) {
        cout << 3 << endl;
      }
      if (b == 3) {
        cout << 2 << endl;
      }
    break;
    case 2:
      if (b == 3) {
        cout << 1 << endl;
      }
      if (b == 1) {
        cout << 3 << endl;
      }
    break;
    case 3:
      if (b == 1) {
        cout << 2 << endl;
      }
      if (b == 2) {
        cout << 1 << endl;
      }
    break;
  }
  return 0;
}
