#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class P8XMatrixTransformation { public:
	string solve(vector <string> original, vector <string> target)
	{
		int so = 0, st = 0;
		for(int y=0; y<original.size(); ++y) {
			so += accumulate(original[y].begin(), original[y].end(), 0);
			st += accumulate(target[y].begin(), target[y].end(), 0);
		}
		return so==st ? "YES" : "NO";
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const string& Expected, const string& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, P8XMatrixTransformation().solve(original, target));}
int main(){

CASE(0)
	string original_[] = {"01"
,"11"};
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = {"11"
,"10"};
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = "YES"; 
END
CASE(1)
	string original_[] = {"0111"
,"0011"};
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = {"1011"
,"1100"};
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = "YES"; 
END
CASE(2)
	string original_[] = {"0"};
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = {"1"};
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = "NO"; 
END
CASE(3)
	string original_[] = {"1111"
,"1111"
,"0000"
,"0000"};
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = {"1111"
,"1111"
,"0000"
,"0000"};
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = "YES"; 
END
CASE(4)
	string original_[] = {"0110"
,"1001"
,"0110"};
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = {"1111"
,"0110"
,"0000"};
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = "YES"; 
END
CASE(5)
	string original_[] = {"0000"
,"1111"
,"0000"};
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = {"1111"
,"0000"
,"1111"};
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = "NO"; 
END
/*
CASE(6)
	string original_[] = ;
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = ;
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = ; 
END
CASE(7)
	string original_[] = ;
	  vector <string> original(original_, original_+sizeof(original_)/sizeof(*original_)); 
	string target_[] = ;
	  vector <string> target(target_, target_+sizeof(target_)/sizeof(*target_)); 
	string _ = ; 
END
*/
}
// END CUT HERE
