#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e9;
string to_bin_string(ll n){
    stringstream ss;
    ss << bitset<32>(n);
    string s = ss.str();
    return s;
}
int main(){
    ll a, b;
    cin >> a >> b;
    
    cout << to_bin_string(a&b) << endl;
    cout << to_bin_string(a|b) << endl;
    cout << to_bin_string(a^b) << endl;
    return 0;
}
