🏡 index : github.com/captn3m0/codechef.git

---
{"category_name":"easy","problem_code":"FAKESWAP","problem_name":"Fake Swaps","problemComponents":{"constraints":"- $1 \\le T \\le 1000$\n- $3 \\le N \\le 1000$\n- $|S| = |P| = N$","constraintsState":true,"subtasks":"- 30 points : $1 \\leq R \\leq 10000$\n- 70 points : $1 \\leq R \\leq 10^9$\n","subtasksState":false,"inputFormat":"- The first line contains an integer $T$ denoting the number of test cases. The $T$ test cases then follow.\n- The first line of each test case contains $N$ denoting the length of $S$ and $P$.\n- The second line of each test case contains $S$.\n- The third line of each test case contains $P$.","inputFormatState":true,"outputFormat":"For each test case, output on one line `YES` if it is possible to convert $S$ to $P$, or `NO` if it is not possible to do so. Output is case insensitive.","outputFormatState":true,"sampleTestCases":{"0":{"id":1,"input":"2\n4\n1001\n0101\n3\n111\n000","output":"YES\nNO","explanation":"- For the first test case, we choose $X=0, Y=1$ and $Z=1$. This satisfies the above condition. Three indices $(i,j,k)$ are chosen as $(1,2,4)$, and $(A_1, A_2, A_4)$ are then assigned as $(0, 1, 1)$ respectively. After this operation, $S$ transforms into `0101`.\n\n- For the second test case, no set of any operations is possible to make $S$ equals to $P$.","isDeleted":false}}},"video_editorial_url":"https://youtu.be/0reLxqLcNHs","languages_supported":{"0":"CPP14","1":"C","2":"JAVA","3":"PYTH 3.6","4":"CPP17","5":"PYTH","6":"PYP3","7":"CS2","8":"ADA","9":"PYPY","10":"TEXT","11":"PAS fpc","12":"NODEJS","13":"RUBY","14":"PHP","15":"GO","16":"HASK","17":"TCL","18":"PERL","19":"SCALA","20":"LUA","21":"kotlin","22":"BASH","23":"JS","24":"LISP sbcl","25":"rust","26":"PAS gpc","27":"BF","28":"CLOJ","29":"R","30":"D","31":"CAML","32":"FORT","33":"ASM","34":"swift","35":"FS","36":"WSPC","37":"LISP clisp","38":"SQL","39":"SCM guile","40":"PERL6","41":"ERL","42":"CLPS","43":"ICK","44":"NICE","45":"PRLG","46":"ICON","47":"COB","48":"SCM chicken","49":"PIKE","50":"SCM qobi","51":"ST","52":"SQLQ","53":"NEM"},"max_timelimit":1,"source_sizelimit":50000,"problem_author":"munch_01","problem_tester":"","date_added":"17-09-2021","tags":{"0":"cook133","1":"munch_01","2":"simple"},"problem_difficulty_level":"Simple-Easy","best_tag":"Simple Easy","editorial_url":"https://discuss.codechef.com/problems/FAKESWAP","time":{"view_start_date":1632078002,"submit_start_date":1632078002,"visible_start_date":1632078002,"end_date":1735669800},"is_direct_submittable":false,"problemDiscussURL":"https://discuss.codechef.com/search?q=FAKESWAP","is_proctored":false,"visitedContests":{},"layout":"problem"}
---
### Read problems statements in [Russian](https://www.codechef.com/download/translated/COOK133/russian/FAKESWAP.pdf) and [Bengali](https://www.codechef.com/download/translated/COOK133/bengali/FAKESWAP.pdf).

You are given two binary strings $S$ and $P$. You need to convert $S$ into $P$ using the following operation any number of times (possibly zero):

- Pick three binary values $X$, $Y$, and $Z$, such that at least one of them is equal to $1$ and at least one of them is equal to $0$. Then, pick three distinct indices $i$, $j$, and $k$, and assign $S_i=X$, $S_j=Y$, and $S_k=Z$.

Determine whether it's possible to convert $S$ into $P$.
<aside style='background: #f8f8f8;padding: 10px 15px;'><div>All submissions for this problem are available.</div></aside>