[Question]
  [
Do you remember [my mat properly grouped by colors](https://codegolf.stackexchange.com/q/148927/70347)?
[![My mat properly grouped by colors](https://i.stack.imgur.com/8hWGAm.jpg)](https://i.stack.imgur.com/8hWGAm.jpg)
Yesterday I was looking at it and realized that some letters fit inside others. Example: a letter `P` fits in the place where the letter `R` goes. So here's a simple challenge: given two letters, return a truthy value if any one of the letters fits inside the other (directly or rotated, but not flipped), or a falsey value if they don't. That is, if the input is `[P,R]` or `[R,P]`, you must return truthy because in both cases one letter fits inside the other. If you get `[L,U]` you must return falsey as neither fit inside the other.
**Rules**
* The input must be two alphanumeric characters in the range [0-9A-Z], as there are also numbers in the mat, in any form you need (two separate chars as two inputs, a list with two chars, a string with the 2 chars, whatever).
* The output must be consistent (the truthy and falsey values must be always the same).
* Following is the table of fittings (note that a letter always fits in its proper place, just in case you get something like `[Y,Y]` as input):
```
char fits inside chars
--------------------------------------------------------
   C             G,O
   F             B,E,P,R
   G             O
   I             0,1,7,B,D,E,F,H,K,L,M,N,O,P,R,T,V,W,X,Z
   L             E
   M             W
   P             R
   S             O
   V             A
   W             M
   0             O
   1             B,E,L
   3             O
   6             9,O
   8             O
   9             6,O
```
I solemnly swear that I have tested every fitting in my kid's mat. *(Dries his sweat from his forehead.)*
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so may the shortest code for each language win!
**Some test cases**
```
input  output
-------------
[C,G]  truthy (C fits inside G)
[G,C]  truthy (C fits inside G)
[F,R]  truthy (F fits inside R)
[M,W]  truthy (both fit inside the other)
[O,S]  truthy (S fits inside O)
[T,T]  truthy (T fits in its place)
[E,V]  falsey (no fit found)
[P,L]  falsey
```
---
[Sandbox post](https://codegolf.meta.stackexchange.com/a/14425/70347). Please, forgive me if you spot more fittings that I missed. Many thanks to [Οurous](https://codegolf.meta.stackexchange.com/users/18730/%CE%9Furous) for helping me with the fittings list.
  
[Answer]
# [Python 2](https://docs.python.org/2/), ~~135~~ ~~130~~ 129 bytes
-1 byte thanks to [Lynn](https://codegolf.stackexchange.com/users/3852/lynn)
```
lambda s:cmp(*s)%2*s[::cmp(*s)|1]in'OIH TIE XI7 RF O8 OGC LI0 O3 O96 VA O6 KI PI WI L1 WMI O0 RIB NI1 FE SOC VID ZIFB1 PF LE1 RP'
```
[Try it online!](https://tio.run/##NccxS8NAGIDh3V/xLnJt6dCrUDXg0MZc/DD1C2lIpOpQlWDApqG5RfC/R25weeDpf/zXqVuOzd3r@H04vn8eGKKPYz@ZDdPL5Wx4if73a9/azqg8UErCs1xTOPQGTWMyWaBX6O2Kao2ueBRyoRYyS70VdEEhG57E4hJ2GlPJPXtxG0vuyBJLkZuxOZ3xtB0mTs0ck8ZBVwS3dVB3wbIMJlUwz0x0Af257Tx@TjPx0/EP "Python 2 – Try It Online")
# [Python 3](https://docs.python.org/3/), 143 bytes
```
lambda*i:any({*i}&{a,c}=={*i}for a,b in zip('CFGILMPSVW013689','GO BEPR O 017BDEFHKLMNOPRTVWXZ E W R O A M O BEL O 9O O 6O'.split())for c in b)
```
[Try it online!](https://tio.run/##Tc1NC4JAEIDhe79iTu1aSyhBH4KHNLVI28VEI7qshrRgKualot9uzq3Lw8AM8zav7l5X876wrn0pH9lNTpQpqxf9TNR3/JEs/1oWzkXdgmQZqAreqqHE8fx9EIpTkurGfLFaE0Z8DrYrIuCgG0t763q7QxAeuYjiJD1fwIUUcLmBEPAyGFzzgQUns2dTqo5qGmZyjGRa/5ckjk8YEN9BvQgNU5Sf0DhG3QQVATFHAE2rqo7KacagoJIN/7T@Bw "Python 3 – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~93~~ 92 bytes
```
O`.
(.)\1|1[BEL]|69|AV|CG|BF|EF|EL|FP|FR|[017BDEFH]I|I[KLMNOPRTVWXZ]|MW|PR|OS|[03689CG]O
^$
```
[Try it online!](https://tio.run/##DcqxDsIgFAXQ/X2HJnVpJCbVjoKAjVQIbaARMXVwcHEwjvffsckZz/f1e3@eZV3pudi5pqre3BlY4tJkNC2OAUKDK8iFgXJQHmnL9vwk1Tl36NLF9Ffr/BjidMvoI5yHHZa0aw6t0NkSPValCE1akPLUR7IDjSPJQM78AQ "Retina – Try It Online") Edit: Saved 1 byte thanks to @ovs.
[Answer]
# [Clean](https://clean.cs.ru.nl), ~~276~~ 226 bytes
Vaguely golfed-ish. Will polish tomorrow.
```
import StdEnv
i a b=isMember b a
t=True
f'C'b=i['GO']b
f'F'b=i['BEPR']b
f'O'b=i['GS03689']b
f'I'b=i['017BDEFHKLMNOPRTVWXZ']b
f'L''E'=t
f'P''R'=t
f'V''A'=t
f'M''W'=t
f'1'b=i['BEL']b
f'6''9'=t
f _ _=False
?a b=a==b||f a b||f b a
```
[Try it online!](https://tio.run/##NY9Ba8JAEIXv@RVzm5OgFLQeFqmaWGnShERUWkRmk01ZyMaSrIWCv73bTcee9nvv7TDzykZR68ylujYKDOnWafN56SwUtgrbr0ADgRS6T5SRqgMJFFix664qqHGFPnnHTYon6WXEchlmORvpPS/GD9PHOXtb9saT2XIdRs8vcfKaZvlufzi@8YcYMURhPWWIOdMe8YkpQTwwTf63xTw3RZz/JXCGs4io6VWwGG4nIeTtVg89hsc3cIUl31DAAvwM@DvdT1k39NG7UfXdktGlp23s1nfxCw "Clean – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), ~~149~~ 145 bytes
```
[]!_=0>1
(a:b:c)!t=(a,b)==t||(b,a)==t||c!t
f x y=x==y||"0I0O1B1E1I1L3O696O7I8O9OAVBFBICGCODIEFEIELFIFPFRGOHIIKILIMINIOIPIRITIVIWIXIZMWOSPR"!(x,y)
```
[Try it online!](https://tio.run/##bdFRa8IwEADg9/6Kaxk0wQ4sg20KEbRru8N2KbXomIhEqShTJ7ayFvrfu6TDuYcmD0nuC8ldshXZZ7rf1/V8oS9Zd2BrRPRX/TXVc0aEtaKM5VVFVpb4na31XNtAASUrGCuryuhil9sj27XRDh74Y@@RP@Ez7/HhdOSN0PEd/oKu56IbeOhFXuzzV8QxBhjiG3KMMMYEpzjDd/wIZ3wSxYZOCqukdZ5muSOyNAMGcw1kI8R0TAtM36QWJOdLCtS6gq/AaQFPQdwCoYJZC3AFkxZIFCQt4CqYKvDEPktvECkIbtDEF5qmapNeWFBKE8eMyiJPl3ySn4Mj3DXbsu3Xt3zpTgcM2eXQBEo5a9iA@8G/OGl@hV51t4EmAIyp4yHfpke5m/AxNSCVqciFN8RANzTtIHZHef1BnMIlNJn9PX39Aw "Haskell – Try It Online")
[Answer]
# Javascript ~~155 153 151~~ 149 bytes
I think this works on all cases, 1/0 for true/false. 
```
(c,f,q=1)=>"CGO,FBEPR,GO,I017BDEFHKLMNOPRTVWXZ,LE,MW,PR,SO,VA,WM,0O,1BEL,3O,69O,8O,96O".split`,`.some((v=>v[0]==c&v.includes(f)))|c==f|(q?F(f,c,0):0)
```
Explanation:
```
F=(
c, // input 1
f, // input 2
q=1 // variable used to execute F twice
)=>(
"CGO,FBEPR,GO,I017BDEFHKLMNOPRTVWXZ,LE,MW,PR,SO,VA,WM,0O,1BEL,3O,69O,8O,96O".split`,` 
                              // array of strings where [0] is input 1 and [>0] are the fittings
.some(                        // any element of the array meets:
(v=>v[0]==c&v.includes(f)))|  // input 1 equals [0] and input 2  exists in the lookup string OR
c==f|                         // input 1 equals input 2 OR
(q?F(f,c,0):0)                // input 2 fits inside input 1
```
```
let F=(c,f,q=1)=>"CGO,FBEPR,GO,I017BDEFHKLMNOPRTVWXZ,LE,MW,PR,SO,VA,WM,0O,1BEL,3O,69O,8O,96O".split`,`.some((v=>v[0]==c&v.includes(f)))|c==f|(q?F(f,c,0):0);
let tests = [
  ["C","G"],  //truthy (C fits inside G)
  ["G","C"],  //truthy (C fits inside G)
  ["F","R"],  //truthy (F fits inside R)
  ["M","W"],  //truthy (both fit inside the other)
  ["O","S"],  //truthy (S fits inside O)
  ["T","T"],  //truthy (T fits in its place)
  ["E","V"],  //falsey (no fit found)
  ["P","L"]   //falsey
];
tests.forEach((v)=>{console.log("F('"+v[0]+"','"+v[1]+"') = " + F(v[0],v[1]))});
```
## Changelog:
* saved 2 bytes thanks to kamoroso94
* saved 2 bytes thanks to Chris M
* saved 2 bytes by changing lookup method to .some()
[Answer]
# [Julia 0.6](http://julialang.org/), 139 bytes
```
(a,b)->(a==b)|any(map(x->all(in.((a,b),x))|all(in.((b,a),x)),zip("OCFILMPV16",split("CGS0368 G BEPR 017BDEFHKLMNOPRTVWXZ E W R A BEL 9"))))
```
[Try it online!](https://tio.run/##NcrBSsNAEAbge59iWAo7C9vQIkQ9pGBjEsXEhDQkpbcJGlhZ11ArVPHd45DFucw3//xvX9ZQOA3RhKR7tdoiRVGvfsl94zuNeFltyVo0LsC5oC@Kn/9Jr2lO9I8ZUZRx@pgXVbsJhf4crTmjiLP9@iq8gQx2SVXDenO9u0/Sh6e8eC6rumm7wxES6KCGO27kcCsUzzR8nIDAOECUsdQyk0oD8tJ8zkyZtWfB7DxL5t6zYTaeCbP1rJi5VGoBPOPJuLN1KJYESxyQgiBQSqjFq3uZ/gA "Julia 0.6 – Try It Online")
Saved some bytes by grouping the chars that fit into 'O'. But testing the reversed input uses too much code...
Explanation:
* `zip(☐)` zips corresponding single letters from `"OCFILMPV16"` & a string of matching letters.
* `.in(☐)` is applied elementwise, e.g. `(in(a,'O'),in(b,"OCFILMPV16"))`
* `all(.in(☐))` Both must be found...
* `|` for either `a,b` or `b,a`...
* `any(map(☐))` for at least one element of the zipped list.
[Answer]
# [Kotlin](https://kotlinlang.org), ~~147~~ 139 bytes
```
fun p(s:String)=setOf(s,s.reversed()).any{it.matches(Regex("(.)\\1|F[BEPR]|I[017BDEFHKLMNOPRTVWXZ]|1[BEL]|69|CG|LE|MW|PR|VA|O[CG69038S]"))}
```
[Try it online!](https://tio.run/##rdfvi6JAGAfw9/0Vc9KLEZZIuquMayHLStJmzsLCNljbxk2utdBpacn@9s5YloU99r4s3uA7PzqPzzO//L2T2yi@XMJDTPY0bU1kEsWPajsVkoU0vUkriXgWSSrWVFUrQfxyimTlKZAPG5FSVzyKI1VoRb2707L@wjC5u8ysRVVrGD2zPxzZzphxd@rN5v4y0/L79jKr61l3kNlm5swy7mZeJ2OL7qCuV2vNyVJR1XNpn0TPgRQkisPoSK6RvUZVuQ8jSdLN7rBdk5W4p6sWMXa7rQhilZxKJG/5o7HcxlQxj3vxIMWaXB8Jdwkpy02Ukvwqr0i7fUvKpyikq3Z7T683VFVhI4WIbSqIMmLf8qacFbV0Ll27fwqimAatTpIELz9fY7l96/HalO5AIR@CIzI5iHcx6CLRd5FwZkiwCRLTKRKm97cIgzwx74Tbn5GvpKTLYEoMKEwoePHED2CkVhUKDYoGFDAfVg8KmDGrD8UQihEUNhQOFGMocOXg@LDg@LDgpLI8KODktuZQ@EjYZvFFhsN8TGDWvQ4SM1j9KuxFg/NFg/nQ4DitwTjqOhTwHU0o9DoUn73jK/sUg8KAC4gJBYfChYLBLahqwfJD0YDCgKIHhQlFH4ohFCMobCgcKMZQMCg4FC4UUyg8KGZQzKHwcfXt4suly4ufHjvefzijwqOSAY9KJhQ2FKxWfEFlWDSLbw5Mh8s2h8Wtwc/1fdiNo8N/g18/8O9DE5Iah8T/Dsm88S9yvlz@AA "Kotlin – Try It Online")
The example on *Try It Online* includes test cases for every positive combination and a few negative ones.
I haven't optimized the reg.ex. too much, so it might be longer than necessary
**EDIT:** saved a few bytes on reg.ex.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 211 bytes
A first attempt. Very straight-forward.
```
i;char*c="CFGILMPSVW013689",*x[]={"GO","BEPR","O","017BDEFHKLMNOPRTVWXZ","E","W","R","O","A","M","O","BEL","O","9O","O","6O"};h(a,b){return(i=strchr(c,a)-c)>=0&&strchr(x[i],b);}f(a,b){return a==b|h(a,b)|h(b,a);}
```
[Try it online!](https://tio.run/##bY1Ra4MwFIWf66@QQGssKbQMunWSwtqpG9MpVnSs7UPM2ipsMlKFjs7f7m5WA3tYyM093@WcGz46cN62hcVzJoacoqXjPnp@uErS8eRqejNDZHhab@kZuQEiaGGHETQpx5Prxb3tPDx5/nMQRnGSvrzC2IZKoZTtDsrv9ML2OjULOjENUGPlmJHMPItdVYsSF/RYCZ4LzAkzR9yc0/Fg0I1O62ILVqvZ/43ojNLs@7IFWgY5q2mLstIPWL6M6LJlpnbWep8C9B6jPtfh0rnef9uUiEhTRnS5F4ympTWaJkMfrCjxJVhXR4xiUVf51@2mHF0OAmvvgI2lQQzX6MAFWCpwACIFPkCqIABYKYgB4l9QX21Kh70fd/98ZoM3UcEQwJPQtD8 "C (gcc) – Try It Online")
[Answer]
# [PHP](https://php.net/), 204 bytes
*-147 bytes because I cam back to remove 2 bytes only to find that my code had a few bugs and unused variables! My code is now much shorter.*
```
<?php $a=fgets(STDIN);for($w=0;$w<2;$w++){if(strpos(explode(',','GO,BEPR,O,017BDEFHKLMNOPRTVWXZ,E,W,R,O,A,M,O,BEL,O,9O,O,6O')[strpos(CFGILMPSVW013689,$a[0])],$a[1])!==false){echo"t";break;}$a=strrev($a);}
```
[Try it online!](https://tio.run/##LY5tC4IwHMS/SsWgjf4vtMCKJdGDWqRNLDQSX6yaGQUOlQqiz24T4uB3L@44TmayridTmckW4mZ6FVWJd/vlektomhcYvUyNotekr9Drkc8txWVVyLzE4i0f@UXgLig5DOaWHwADTR/Ol5a92rjelvnBPowOR7AggiacgQdN01UcMwWDdUn8H1zYztr1/F0YafrAGI0B8VhLSNK4npC2aab8UQryEecs71QdeioEv9Ovuq0WCvHEiBP6revA/gE "PHP – Try It Online")
[Answer]
# Ruby, 140 bytes
```
->c,t{x='CFGILMPSVW013689'.chars.zip('GO BEPR O 017BDEFHKLMNOPRTVWXZ E W R O A M O BEL O 9O O 6O'.split).to_h;p x.key?(c)&&x[c].include?(t)}
```
Pretty much the same as the python 3 answer, but with a different execution.
]