[Question]
  [
Traveling with electronics is always fun, especially when you need an adapter to charge them. Your challenge is to make planning a trip a little easier by checking if a given plug will be compatible with a given socket.
### Challenge
Given a plug type and a socket type, return a value that indicates whether they will work together or not.
### Compatibility table
```
Socket  Accepted plugs  |  Plug  Accepting Sockets
A       A               |  A     A, B
B       A, B            |  B     B
C       C               |  C     C, D, E, F, H, J, K, L, N, O
D       C, D, E, F      |  D     D
E       C, E, F         |  E     D, E, F, H, K, O
F       C, E, F         |  F     D, E, F, H, K, O
G       G               |  G     G
H       C, E, F, H      |  H     H
I       I               |  I     I
J       C, J            |  J     J
K       C, E, F, K      |  K     K
L       C, L            |  L     L
M       M               |  M     M
N       C, N            |  N     N
O       C, E, F, O      |  O     O
```
The tables show the same information, only transposed.
[For reference](https://www.worldstandards.eu/electricity/plugs-and-sockets/).
### Input
* The input will be given as two uppercase or two lowercase letters (you choose).
* Inputs will always be `/[A-O]/` (or `/[a-o]/`), there's no need to handle invalid inputs.
* You may accept the two inputs in any order (please specify which).
* Input can be taken in [any reasonable format](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods) (string, stdin, array, ...).
* If you take both inputs in a single string, they can be separated by no more than one character and there must be nothing surrounding them
* Good inputs: `"G,K"`, `"EF"`, `"a b"`, `['l', 'o']`
* Bad inputs: `"K l"`, `"f(O)(I)"`, `[1,5]`
### Output
* Output can be returned in [any reasonable format](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods).
* Output must be either `truthy`/`falsy` or one of 2 constant values
* Good outputs: `false`/`any positive number`, `1`/`2`, `'T'`/`'F'`
* Bad outputs: `an even number`/`an odd number`, `1`/`more than 1`
### Examples
Using the format `socket`, `plug` => `true` / `false`.
```
A, A => true
I, K => false
O, C => true
C, O => false
E, F => true
F, E => true
```
[Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are disallowed.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the answer with the fewest bytes in each language wins.
  
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~30~~ 29 bytes
```
(.)\1|[DEFHKO][CEF]|[JLN]C|BA
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7wX0NPM8awJtrF1c3D2z822tnVLbYm2svHL9a5xsnx/39HRy5Pby5/Zy5nfy5XNy43VwA "Retina 0.8.2 – Try It Online") Link includes test cases.
[Answer]
# [Python 3](https://docs.python.org/3/), 76 bytes
```
lambda s,p:any([s==p,p in"CEF"and s in"DEFHKO",s=="B"<p,s in"JLN"and"C"==p])
```
[Try it online!](https://tio.run/##VZAxb4MwEIX3/IrTTURyhyobioeUYqVNFRY2iiqXQINCjWUbVfn19Gygoh6s7@7ee/JZ3921V7ux4e9jJ78/LxIs07FU96iwnGumoVWYpAKluoD1xXMqjqcMGY3xCfeahe7r29lLMEFyldvR1HbonAUOBR4OOTJ8OQm6s8RzknlOhWeR5lhumt7A5KG0mWy8ATq2r261Y6C74YuBVPanNpQ7aYKiGVT1Mbs5NNHasQ2KP9cCHDDHMKp6Y@rK/ZutAoNGm1a5aGoU8cNjubyDraWMdm3VnEebLVQWM9G//AI "Python 3 – Try It Online")
# Credits:
* From 83 to 76 bytes by [(Better) Neil](https://codegolf.stackexchange.com/users/17602/neil)
[Answer]
# [Python 3](https://docs.python.org/3/), ~~72 Bytes~~ ~~73 bytes~~ 70 bytes
```
lambda p,s:s in{"A":"AB","C":y+"CJLN","E":y,"F":y}.get(p,p)
y="DEFHKO"
```
[Try it online!](https://tio.run/##XZDBb4IwFMbP61/R9CRZ42G7kXBQFBEQl@y4LQRZ1WZAK5Qsxvm3s9enmbIemt/Xvve9r9VHs1f1c3/w3vsyrzafOdW8dVsq6xObMJdNpowzn7nHR@ZHSQpiDoKzAPbzeCfMSHPtkKPHZvMgjNesl5VWjaHSiMYoVbaE6LLbZUZlrSq@hKEePZGHP3PAKeCFYBDzrVEUJ@kaj2ZwNEOaW7oMsTIYygXIBVIIFCItgZZIEVCEFAPFSAlQgrQCWiGlQCnSGsg6nwkxorWpIa7NtgiXkG4F8Uihqk3r3Z46tgeyzo1UdZt9S7PPGqHLvBCVqM3I@nD65BCyVQ21v8Lp9U9kTdHMJRRWXpguL6G37Uo7@VY0/Mo3Kz@wZdvVxa3hMLp3d7ACN91ICMJe4NalpzP9oa9YchETnHu9CMDxir5qGlFgERtD9io3gwF8mJjfp@H/X@Pd3zpO/ws "Python 3 – Try It Online")
Edit: Thanks to [Chas Brown](https://codegolf.stackexchange.com/users/69880/chas-brown) for cutting some fat!
[Answer]
# [C (gcc)](https://gcc.gnu.org/) (x86 architecture), 76 60 bytes
Many thanks to Arnauld for the changes!
Arguments are given in (plug, socket) order.
```
c[15]={6,0,56696,0,35184,35184};f(a,b){a=a==b|c[a-65]>>b&1;}
```
[Try it online!](https://tio.run/##bZDfToMwFMbv9xQnNZMSihnREl0pi29gondjF6XA1oqwQPEGeXakoFtMvDn/vt93TnKkf5RyvFGVLLssh6g1marvTvEo9wE98D4kG0LD8Mnmexo8PixxYAUWJHV7wQXn6ZfcCz@khzhObwM2jKoy8CFUhT9rlbnQrwDkSTQwWdhUW1kRbctzMzUFRi9ld0zMmoZtUiGCXmv5nhvkWqSoG6y4HzAVBZQpz1sWAgiuPOfZYXNjKW0pbSl9pQBSrq/cdL0ArKKNe7m9lolBBLCehjsHnG3q/rJ52eazQf9jEH@xi9rO6vKgHXpruhxtkY9@6GGO5860GC2zYTWM3w "C (gcc) – Try It Online")
[Answer]
## Haskell, 67 bytes
```
p#s=p==s||or[elem s b|a:b<-words"AB CDEFHJKLNO EDFHKO FDEHKO",a==p]
```
Arguments to function `#` are two characters, plug first, socket second.
[Try it online!](https://tio.run/##NcfRCoIwFIDh@57ioBdzYD1AtAvTDctqDyAS04SkqWNLIvDd1yHYxc/P91Tu1WvtvYkdM4y5dZ1t3et@BAftqvbtYfuZ7cNF2RHygovyXF1uEnghykqCKDguShVjpvGjGiZgMCpzvUNi7DC9YQfL1C3WfpOYUqg3AAnJSIrR9I8KcQrIETJAIvIAgeABHCEIbfwP "Haskell – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 79 bytes
```
S=>P=>P==S|P<'B'&S<'C'|P=='C'&'JLN'[K='includes'](S)|'CEF'[K](P)&'DEFHKO'[K](S)
```
Invoked as a curried function, `f(socket)(plug)`.
[Try it online!](https://tio.run/##dZJtb6owFMff8ymOuZttEy57P8cWRZ3zOeElIRkXy4ZywbQ676J8dnfawpTkDiH@2p7zP09dRx@RjEW63f3OixU/n@/uwIuyDA7p7h0iIaJPCGQRb/jOhm22fwutuMjlDrpCgAs0sUHiAQP3ERIaKA6ZVYtEEuK9EClfATUijCoRVol4@/@ISLRhVmURKB0bkjwE1wIIlIsNvvu4VK/rn5YPpEfa/gPxyAk38K9NxtM5CSYuSfM426@4JCH12Yl4gyFuh3TJ2qQ/GI4mC730GYSdOp7KzteZzqIt5nbEoN17IN0esRF7iIY8JE@pjCfT@UJv9XGrr2mgyERQy2Fz@YzLZ00jpJGmF6QXTWOksaYJ0kTTFGmqaYY00zRHmmtaICnlsqqiyLiTFW@UAD63ktiw@LPm8c7Z8E9JGxUyZ12kubIkjHWspBBAM27aAGnebAfT3VDHojhgbwJsG8C3jxnwD14Apr/83xYzwfvgNq0CfbecemL1belcuQoe8/RDu/YKrDHKqbocNMltuL6hrOH1NxIb9LjEdS9CT0Dwh91rEeOCdTnbvXynrzdH5VjeHK@Nf2ljh5TV6WsVKU2AfgdoXQLUpZtc1FgOkcBu97r9FjHJ1qlXSqVlvsYYb@W9GaNxUEmaqemZldb5/AU "JavaScript (Node.js) – Try It Online") (includes testcases, showing a matrix of results.)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 31 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
Oḅ⁴_ȷe“j⁼⁽⁾ƇƑƓƘƝƤḄẸỊṂṢỴẒĊḞĿ‘o⁼/
```
A monadic link accepting a list of characters `[plug,socket]` which yields `1` if compatible or `0` if not.
**[Try it online!](https://tio.run/##AVQAq/9qZWxsef//T@G4heKBtF/It2XigJxq4oG84oG94oG@xofGkcaTxpjGncak4biE4bq44buK4bmC4bmi4bu04bqSxIrhuJ7Ev@KAmG/igbwv////RUM "Jelly – Try It Online")** Or see a [test-suite](https://tio.run/##AYEAfv9qZWxsef//T@G4heKBtF/It2XigJxq4oG84oG94oG@xofGkcaTxpjGncak4biE4bq44buK4bmC4bmi4bu04bqSxIrhuJ7Ev@KAmG/igbwv/@KAnEFCQ0RFRkdISUpLTE1OT@KAnXDCtcOHxocsw4fDkOG4n0vigqxq4oG@wrbCtv8 "Jelly – Try It Online") (which separates out the two classes).
[Answer]
# [R](https://www.r-project.org/), ~~132 129~~ 113 bytes
```
function(S,P,`!`=utf8ToInt)"[<-"(diag(15),cbind(rep(!"",!"	"),!"



"),1)[-64+!P,-64+!S]
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP08jWCdAJ0Exwba0JM0iJN8zr0RTKdpGV0kjJTMxXcPQVFMnOSkzL0WjKLVAQ1GJkZmVTUkHSHOysSlpAhlMXDx8LKxsHNz8yCRQylAzWtfMRFsxQAdMBcf@T9NQclTSUQASmgrKCrZ2CiVFpalcQFFPkKg3TDQtMacYLOwPEnZGV@wMEvXHUOwKEnZDV@wGEnVFFv0PAA "R – Try It Online")
Builds the following matrix and extracts `m[S,P]` => 1 if TRUE, else 0.
```
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15]
 [1,]    1    1    0    0    0    0    0    0    0     0     0     0     0     0     0 
 [2,]    0    1    0    0    0    0    0    0    0     0     0     0     0    0     0
 [3,]    0    0    1    1    1    1    0    1    0     1     1     1     0    1     1
 [4,]    0    0    0    1    0    0    0    0    0     0     0     0     0    0     0
 [5,]    0    0    0    1    1    1    0    1    0     0     1     0     0    0     1
 [6,]    0    0    0    1    1    1    0    1    0     0     1     0     0    0     1
 [7,]    0    0    0    0    0    0    1    0    0     0     0     0     0    0     0
 [8,]    0    0    0    0    0    0    0    1    0     0     0     0     0    0     0
 [9,]    0    0    0    0    0    0    0    0    1     0     0     0     0    0     0
[10,]    0    0    0    0    0    0    0    0    0     1     0     0     0    0     0
[11,]    0    0    0    0    0    0    0    0    0     0     1     0     0    0     0
[12,]    0    0    0    0    0    0    0    0    0     0     0     1     0    0     0
[13,]    0    0    0    0    0    0    0    0    0     0     0     0     1    0     0
[14,]    0    0    0    0    0    0    0    0    0     0     0     0     0    1     0
[15,]    0    0    0    0    0    0    0    0    0     0     0     0     0    0     1
```
Saved 3 bytes by compressing indexes using `intToUtf8` and replacing this function with `!`. See History for more legible version.
Saved 16 bytes thanks to @Giuseppe!
[Answer]
# [PHP](http://www.php.net/), 81 bytes
```
<?list(,$s,$p)=$argv;$A=AB;$C=$E=$F=DEFHKO;$C.=JLN;echo+($p==$s||strpos($$p,$s));
```
To run it:
```
php -n -d error_reporting=0 <filename> <socket> <plug>
```
Example:
```
php -n -d error_reporting=0 socket_plug_compatibility.php F E
```
Or [Try it online!](https://tio.run/##DczBCsIwDADQX/GQQ4ubeK9B5mwRFf0EES3bQJqQFE/7duOO7/J4ZLPd/jNpdQ1oA@wRnjJ8A3TYHQL0CBEh4TGm0@W@eIPn6y3k10hrB4wIOs9ahUkdAC@H98HMksUfcZ2oqLXF2vcqi5A8JDNJncqA2z8 "PHP – Try It Online")
**Notes:**
* To save some bytes, I have used strings without single/double quotations as the string wrapper. Thus, the `error_reporting=0` option is used to not output warnings.
* Input only works with uppercase letters.
* Outputs 1 for compatibility and 0 for non-compatibility.
---
# How?
Every plug is compatible with same socket as itself. There are four special plugs (A, C, E, F) which are compatible with a few more sockets as well. Four string variables with the name of the special plugs are defined to hold list of their extra compatible sockets.
It is checked if input plug and socket are same or if the socket is in the list of compatible sockets for that plug. The latter check is done with the help of [PHP's variable variables](http://php.net/manual/en/language.variables.variable.php).
[Answer]
# Javascript ES6, ~~66~~ ~~65~~ 64 chars
```
p=>s=>p==s|{A:1,C:14172,E:8788,F:8780}[p]&(1<<parseInt(s,36)-11)
```
Takes capital letters into `p` for plug and `s` for socket, returns falsy (`0`) or truthy (`1`, `2`, `4`, ..., `8192`) value.
### Test:
```
f=p=>s=>p==s|{B:1,C:14172,E:8788,F:8780}[p]&(1<<parseInt(s,36)-11)
console.log(`A, A => true
I, K => false
O, C => true
C, O => false
E, F => true
F, E => true`
.split`
`.map(x=>x.match(/(.), (.) => (\w+)/))
.every(([m,p,s,res])=>!!f(s)(p)==eval(res)))
```
[Answer]
# [Pascal (FPC)](https://www.freepascal.org/), 113 bytes
```
var p,s:char;begin read(p,s);write((p=s)or(pos(p,'CEF')>0)and(pos(s,'DEFHKO')>0)or(pos(p+s,'AB CJ CL CN')>0))end.
```
[Try it online!](https://tio.run/##NcpBCgIxDEDRq2TXBkdx7aCgsYOo6BliW3VAOiEVPX4tBbfvf@Hs@TW/iy/lwwrS5ZV/sva3@BgTaORgq2H/1fEdrZV1xkmtTLmyITcY3CyRU2iUO7N3w@F0bfr/ZpW3O6Aj0Bno0hrGFBalkPsB "Pascal (FPC) – Try It Online")
[Test for all values](https://tio.run/##XY1BCsIwEEXX9hSzmwSruHLR0kKNLaJizxCbVAslCZmix48h6MbN8Hnv88dJGuS8Gd0Qwkt6cDkVw1P6Mrvrx2Sy1WgjLCpsEBYL2CMoC1@XJP3Lt58WzZiriFvPnCXmchRth7zecWlUQpTjse1Olz7RX28dcXMAcQZxBXFLDoo9L@OvNDubGLVRZRbPNoQP)
Following the `DEFHKO` train...
`pos(string1,string2)` checks for first occurence of `string1` in `string2` and returns its position in it or 0 if it doesn't exist.
]