[Question]
  [
In chess, *fork* means to target two pieces with just one piece, and one of the best pieces for forking is the knight.
In this challenge, you will be given three coordinates in `a` to `h` and `1` to `8` (like `a8` or `e7`) format. The first and second coordinates are for two other random pieces, and the third is the knight's coordinate. You must return or output the coordinate where the knight can move to create a fork, attacking both pieces. An example is this:
[![chess](https://i.stack.imgur.com/jRBoc.png)](https://i.stack.imgur.com/jRBoc.png)
Here, the first and second inputs will be `d6` and `f6` and the third (knight) will be `g3`. You must return `e4`, where the knight can attack both rooks.
### Testcases
```
Input: d6,f6,g3 | Output:e4
Input: d4,d6,e7 | Output:f5
Input: c3,f2,b2 | Output:d1
```
#### Notes
* You may assume it is possible to find a fork with the given input.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the shortest code wins!
  
[Answer]
# [Python 2](https://docs.python.org/2/), 129 bytes
```
def f(a):x,p,y,q,z,r=map(ord,a);x-=z;y-=z;p-=r;q-=r;u=x*x+p*p;v=y*y+q*q;w=x*q-y*p<<1;return chr((u*q-v*p)/w+z)+chr((v*x-u*y)/w+r)
```
[Try it online!](https://tio.run/##VchLDoIwEADQvacgrNppGyMYTCw9DFIqLoTphE/L5Su4MW7e4mGc@nEoUrKdyxxr@D1IlFF6uUky7wbZSFY2XAdlNh0PUBnS/mA2AYJAQL2YCFF48Hrdz6sIWNcXTd0005C1PTE2770A8vMqNi6@tUBQM8SjiCek1zAxx3JbuepZ5pyffnW1VXf7q7Z0xaPYK30A "Python 2 – Try It Online")
Input as a single string like `f("d6f6g3")`.
For given three points \$\left(x\_1,y\_1\right)\$, \$\left(x\_2,y\_2\right)\$, \$\left(x\_3,y\_3\right)\$, the center of the circle determined by these three points is
$$
\left(
\frac{\left|\begin{matrix}x\_1^2+y\_1^2 & y\_1 & 1 \\ x\_2^2+y\_2^2 & y\_2 & 1 \\ x\_3^2+y\_3^2 & y\_3 & 1 \end{matrix}\right|}{2\cdot\left|\begin{matrix}x\_1 & y\_1 & 1 \\ x\_2 & y\_2 & 1 \\ x\_3 & y\_3 & 1 \end{matrix}\right|},
\frac{\left|\begin{matrix}x\_1^2+y\_1^2 & x\_1 & 1 \\ x\_2^2+y\_2^2 & x\_2 & 1 \\ x\_3^2+y\_3^2 & x\_3 & 1 \end{matrix}\right|}{2\cdot\left|\begin{matrix}x\_1 & y\_1 & 1 \\ x\_2 & y\_2 & 1 \\ x\_3 & y\_3 & 1 \end{matrix}\right|}
\right)
$$
And this formula is find out from [this SE post](https://math.stackexchange.com/a/1460096). I'm too lazy to find out the formula by myself.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~50~~ ~~21~~ 19 bytes
```
ƛk-:dẊ:RJ$Cv+C;Þf∆M
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLGm2stOmThuoo6UkokQ3YrQzvDnmbiiIZNIiwiIiwiXCJkNlwiLCBcImY2XCIsIFwiZzNcIiJd)
One of the programs ever written. Luckily, there's no enpassant with horseys, so there's no bricks needed. However, I will note that this doesn't account for knightboosting. Also doesn't account for knook movements.
Uses the simplification of the problem pointed out by @mousetail in the comments.
## Explained
```
□ƛ # To all squares in the input
k-:dẊ:RJ  # Generate all vector directions of how the horsey moves. This is the hardest part because until recently, not even the smartest scientists knew how the horsey moved.
# This will be a list of [horizontal spaces, vertical spaces]
# [[-1, 2], [2, 1], ...]]
# Generated by:
# Doubling the list [1, -1] (k-:d)
# Getting the cartesian product of those two lists (Ẋ)
# Pushing a second copy and reversing each list in it (R)
# And joining it to the cartesian product (J)
Cv+C # To a list of ordinal points of where the horsey is, add each horsey move
ÞfĊ↑h # Flatten by a layer and get the most common square.
```
If you can't tell from that, I am somewhat of a chess anarchist :p
[Answer]
# [Factor](https://factorcode.org/), ~~86~~ ~~79~~ ~~76~~ 67 bytes
```
[ [ """"zip [ 3 v-n v+ ] with map ] map-flat mode ]
```
[Try it online!](https://tio.run/##JY6xTsNAEERly278FYNbFEvESZBCQ4doaBBVlOI475FVzvb5bmMLEN9uLk4zWr23Go1RWno/f7y/vr3sEWi4UKcpoFVyqka6ygDnSeTbee4Ew4Qz@Y7s7SWIEg7COkD3rWNLvroIWxaOLSqEPpqnohimXzQ7mB2@avzhDrS5sc0V0@PCzHZhuoZZ43O9sOahmA84oMyyPE/TJCnLPMnSJE@z8oddNDXGVYfxHkdMLKe4y8Uz5spYJWj7hnCcxfMzqrjSkvLzPw "Factor – Try It Online")
Takes input as a sequence of three strings.
* `[ ... ] map-flat` Map over each element in the input, flattening the results.
* `""""` Two strings with eight literal control characters each. (You can see them on TIO.)
* `zip` Zip them together. These are the knight moves + 3 -- i.e.
```
{ { 4 5 } { 4 1 } { 5 4 } { 5 2 } { 2 1 } { 2 5 } { 1 2 } { 1 4 } }
```
* `[ 3 v-n v+ ] with map` Add the element we're mapping over to each of the knight moves. For example, if the current element is `"d4"`, this is the result:
```
{ "e6" "e2" "f5" "f3" "c6" "c2" "b5" "b3" }
```
* There will occasionally be results that are outside of the board, but it doesn't matter because these will never be the most frequent move.
* `mode` Find the most common move.
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 32 bytes
Takes input as a single list of three strings.
```
`c$*>#'=,/(2-5\28848 84144)+/:\:
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs0pIVtGyU1a31dHXMNI1jTGysDCxULAwMTQx0dTWt4qx4uJKc1DSUYpRSjHTSTPTSTdWAgAvpQti)
Apply all 8 knight moves to each of the pieces, then find the most common target square.
The knight moves are hardcoded using base encoding, the shortest way I found to actually generate them was 5 bytes longer:
```
+,/|:\',/2 -2,'/:1 -1
```
[Answer]
# [Python](https://www.python.org), 96 bytes (@tsh)
```
f=lambda A,R=1:{5}^{(R//9-ord(f))**2+(R%9-int(r))**2for f,r in A}and f(A,R+1)or f"{R//9:c}{R%9}"
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vwYKlpSVpuhY3E9JscxJzk1ISFRx1gmwNrapNa-OqNYL09S1184tSNNI0NbW0jLQ1glQtdTPzSjSKwPy0_CKFNJ0ihcw8BcfaxLwUhTQNoG5tQ02QuFI1SLdVcm01UFOtEtSegIIikP40jWilFDMlHaU0EJFurBSrqcmFJGUCFAXLp5qjSSUbg3QZAYkkI5AUxFyYPwA)
### Old [Python](https://www.python.org), 100 bytes
```
f=lambda A,R=1,F=97:{5}^{(F-ord(f))**2+(R-int(r))**2for f,r in A}and f(A,R%8+1,F+R//8)or f"{F:c}{R}"
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vwYKlpSVpuhY3U9JscxJzk1ISFRx1gmwNddxsLc2tqk1r46o13HTzi1I00jQ1tbSMtDWCdDPzSjSKwLy0_CKFNJ0ihcw8BcfaxLwUhTQNoG5VC22gfu0gfX0LTZACpWo3q-Ta6qBaJahdAQVFIDPSNKKVUsyUdJTSQES6sVKspiYXkpQJUBQsn2qOJpVsDNJlBCSSjEBSEHNhfgEA)
Expects a list of three two-character strings. Trusts OP's promise that it is a forkable position (will never return otherwise).
### How?
Well, there are only 64 candidate squares so we check them all.
[Answer]
# [Python](https://www.python.org), 144 bytes
```
lambda a,b,c:(g(a)&g(b)&g(c)).pop()
g=lambda x:{chr(ord(x[0])+i)+str(int(x[1])+j)for(k,l)in((1,2),(-1,2),(1,-2),(-1,-2))for(i,j)in((k,l),(l,k))}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=RY5NDoIwEIX3nIKwMDNhMFaNGhJOoi74sbWA0NSaYIx3cO-GDd7J21h-EjfvZd77ZjLvj7qbc121HXcj99DdDA9231cZX5IsdmNKKA1BQIwzAUkvKeJc1QrQEdFENeEjPWuodQbNfnFEX6J_NRpkZWzAbJAjrzUUVKKsABgtkSAYjVEwTdYHTFI-YD1OUFKB-Jz-Ykr3Rzl42cYjj_ciVh6i8y_WNhva09YW42Lbjv4D)
Performs "en passant" whenever possible. Which is never, since there are no white pawns.
[Answer]
# Excel, ~~126~~ 122 bytes
Saved 4 bytes by dropping `m` as a variable.
```
=LET(a,A1:C3,x,CODE(A1:A3)-96,c,MMULT(MINVERSE(2*IFS(a=0,.5,ISTEXT(a),x,1,a)),x^2+B1:B3^2),CHAR(INDEX(c,1)+96)&INDEX(c,2))
```
Inspired by [tsh's answer](https://codegolf.stackexchange.com/a/256856/38183) although I found a different formula. Note that Excel will change `IFS(a=0,.5,` to `IFS(a=0,0.5,` after you enter the formula.
Input is in the range `A1:B3` with one half of each coordinate per cell. The range `C1:C3` must be left blank. The formula can go anywhere except in the range `A1:C3`. The first testcase is input like this:
[![test case](https://i.stack.imgur.com/DQB0p.png)](https://i.stack.imgur.com/DQB0p.png)
The `LET()` function allows you to store data as variables and later reference those variables. The terms are in pairs except the last which is the output.
* `a,A1:C3` stores the input range as a 3x3 array.
* `x,CODE(A1:A3)-96` stores the number version of the input letters in a 1x3 array.
	+ You *could* leave off the `-96` part here and the `+96` part later but doing that matrix math with larger numbers has rounding errors so you may sometimes get answers like `e4.00000000000023` and these two offsets are less bytes than trying to round it later.
* `IFS(a=0,.5,ISTEXT(a),x,1,a)` converts the input array into a more usable form by:
	+ Replacing the blanks in `C1:C3` with `.5`
	+ Replace the characters in `A1:A3` with their numerical equivalent
	+ The end result looks like this:  
	
	[![Value of m](https://i.stack.imgur.com/nGzg7.png)](https://i.stack.imgur.com/nGzg7.png)
* `c,MMULT(MINVERSE(2*IFS(~)),x^2+B1:B3^2)` does fancy math stuff ([that I did not write myself](https://www.mrexcel.com/board/threads/find-centre-radius-from-3-x-y-points.1132340/#post-5476135) but I did tweak a bit) and it spits out a 1x3 array with the x-coordinate, y-coordinate, and constant from the general equation for a circle. For the first testcase, the value of `c` looks like this:  
[![Value of c](https://i.stack.imgur.com/aMcRz.png)](https://i.stack.imgur.com/aMcRz.png)
* `CHAR(INDEX(c,1)+96)&INDEX(c,2)` changes the x-coordinate to a letter and concatenates it with the y-coordinate.
---
Here are the results for the three testcases:
[![Results](https://i.stack.imgur.com/eUX0X.png)](https://i.stack.imgur.com/eUX0X.png)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~52~~ 30 bytes
```
Ｆ³⊞υＳΦΣＥβＥχ⁺ιλ⬤υ⁼⁵ΣＸＥλ⁻℅ν℅§ιξ²
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NY69CsIwFIX3PkVwuoEIarEITh0UOoiFjuKQtrYNXNOaH-27uHRQ9JV8GxN_znIPB76Pe30WDVdFy3EY7tZU48XrXrWKQEhJanUDlpFEdtZkRglZA6XLIHXNwFqgOSjI7BE2vIOcEX-mE0ZStBoEI0hdGIkRvWV1shw1zBnxSNpeHOwJdKCQjtiqUkiOIB3z77FJZHnova3_2mb0k-VN54X-vfzYjcZnHO2fZRRUUVCH3_kN) Link is to verbose version of code. Explanation:
```
Ｆ³⊞υＳ
```
Input the three strings.
```
ΦΣＥβＥχ⁺ιλ
```
Create the 260 strings `a0` to `z9` and filter on the one that satisfies...
```
⬤υ⁼⁵ΣＸＥλ⁻℅ν℅§ιξ²
```
... the sum of the squared ordinal differences between corresponding code points is equal to `5`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
O+€Ø+pḤUƬẎ¤f/Ọ
```
A monadic Link that accepts a list of the three distinct, pairs of characters and yields a list of one pair of characters representing the destination square. When run as a full program the destination is printed.
**[Try it online!](https://tio.run/##y0rNyan8/99f@1HTmsMztAse7lgSemzNw119h5ak6T/c3fP///9o9WRjdR0F9TQjEJlkpB4LAA "Jelly – Try It Online")**
### How?
The square on which the knight may fork is the square all three pieces could move to *if* they were all knights. The code finds those three sets of squares (including off-board ones\*) and finds the intersection.
```
O+€Ø+pḤUƬẎ¤f/Ọ - Link: list of lists of characters, C
O              - cast (C) to ordinals
          ¤    - nilad followed by link(s) as a nilad:
   Ø+          -   [-1, 1]
      Ḥ        -   double -> [-2, 2]
     p         -   cartesian product -> [[1,2],[1,-2],[-1,2],[-1,-2]]
        Ƭ      -   collect while distinct applying:
       U       -     reverse each -> [[[1,2],[1,-2],[-1,2],[-1,-2]],[[2,1],[-2,1],[2,-1],[-2,-1]]]
         Ẏ     -   tighten -> [[1,2],[1,-2],[-1,2],[-1,-2],[2,1],[-2,1],[2,-1],[-2,-1]]
 +€            - add to each ordinal pair (vectorises)
            /  - reduce by:
           f   -   filter keep
             Ọ - cast to characters
```
---
\* Even though off-board positions may be present in the three sets I believe that this will yield the single destination square if possible or an empty list if not possible. (The three inputs just need to be distinct!)
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 20 bytes
```
{l;1~ȧᵐ≜p;?ạᵗz+ᵐ~ạ}ᵛ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6Ompoe7Omsfbp3wvzrH2rDuxHIg81HnnAJr@4e7Fj7cOr1KGyhQB2QD1cz@/z86WinFTElHQSkNTKYbK8XqKADFTEA8iEyqOUQs2RiszghEJhkpxcYCAA "Brachylog – Try It Online")
```
{                 }ᵛ    Produce the same output from all elements of the input:
 l                      take the element's length (2),
  ;1                    pair it with 1,
    ~ȧᵐ≜                un-absolute-value both,
        p               and permute;
         ;   z+ᵐ        sum with corresponding elements of
           ạᵗ           the character codes of
          ?             the element;
                ~ạ      convert from character codes.
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 16 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Ç®X‚xâDí«δ+çJ˜.M
```
Inspired by [*@mousetail*'s comment](https://codegolf.stackexchange.com/questions/256814/knight-to-fork#comment568140_256814)!
[Try it online](https://tio.run/##yy9OTMpM/f//cPuhdRGPGmZVHF7kcnjtodXntmgfXu51eo6e7///0UopZko6SmkgIt1YKRYA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/w@2H1kU8aphVcXiRy@G1h1af26J9eLnX6Tl6vv91/kdHK6WYKekopYGIdGOlWB2ggAmQDRZNNQcLJBuDVBgBiSQjpdhYAA).
**Explanation:**
```
Ç         # Convert the (implicit) input-triplet of strings to pairs of their codepoints
®X‚xâDí«  # Push list [[-1,-2],[-1,2],[1,-2],[1,2],[-2,-1],[2,-1],[-2,1],[2,1]]:
®X‚       #  Push pair [-1,1]
   x      #  Double the values in this pair (without popping): [-2,2]
    â     #  Get the cartesian product of the two pairs
     D    #  Duplicate this list
      í   #  Reverse each inner pair
       «  #  Merge the two lists together
δ         # Apply on the two lists double-vectorized:
 +        #  Add them together
ç         # Convert each inner-most integer back to a character with this codepoint
 J        # Join each inner pair together to a string
  ˜       # Flatten the list of lists of strings
   .M     # Pop and leave the most frequent string
          # (which is output implicitly as result)
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
⁹p`ạỤ€Ƒ¥ƇOỌ
```
[Try it online!](https://tio.run/##y0rNyan8//9R486ChIe7Fj7cveRR05pjEw8tPdbu/3B3z//D7ZqR//9Hq6eYqesoqKeByXRj9VgdBaCYCYgHkUk1h4glG4PVGYHIJCP1WAA "Jelly – Try It Online")
Sidesteps actually generating knight moves by just checking them with good old brute force.
```
⁹p`            Generate the Cartesian product of [1 .. 256] with itself.
⁹p`            256 is Jelly's smallest single byte constant >= 108,
         O     the character code of 'h'.
        Ƈ      Filter that list of pairs to the single one for which
   ạ   ¥       the list of its element-wise absolute differences from each of
         O     the input pairs converted to character codes
      Ƒ        is equal to itself with
     €         each difference pair
    Ụ          graded up (converted to a list of indices sorted by their values).
    Ụ Ƒ        Every list of length 2 grades up to either [1, 2] or [2, 1].
          Ọ    Convert the surviving pair from character codes.
```
[Answer]
# [C (GCC)](https://gcc.gnu.org), ~~138~~ ~~133~~ ~~131~~ 126 bytes
*-12 bytes thanks to [@ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)*
```
f(s,x,b,i)char*s,*x;{b=0;for(*x=96;b=i=!b&(++x[1]<58||++*x<105&&(x[1]=48));)for(;i<8;i+=3)b*=abs((*x-s[i-1])*(x[1]-s[i]))==2;}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=fZBNbsIwEIXX5BQuUiOPPRE4f03l-CQ0qmKDqSUaqphKloBepBs2rHqi3qYJ0C3L-fS9p6f5PpvXtTGn0_lzZ5Pq98tSjwE1OjBvbc88siD3Ws2l3faUBfVcSq2cetAx5TwsRFMX1eHAOQu1mBdxTEem8gpAwhiRrq6k4yoDzVSrPR1KEr9wiWiAXeTxagCUSuXxtuLHdTvy3rqOwj6ajEMIC0QR0242W0MzJAJkNLF0uizRlrjOpkgCSPLRD8kBP_qX7oZmM7LKr26Og756uuva4uKaDG2KOr3rLkV0jK6T_x_4Bw)
[Answer]
# [Ruby](https://www.ruby-lang.org/), 113 bytes
```
->s{a=s.bytes
20000.times{|i|(a[1+j=i%3*2]-y=i/3%58)**2+(a[j<1?C=0:j]-x=i/174)**2==5&&C+=1
C>2&&(p x.chr+y.chr)}}
```
[Try it online!](https://tio.run/##TclLCoMwFIXhuasQi8EHWpP4KNJrBy6gCxAHPpJWoSBGwaCuPdWZZ3AG3z/OtVQclJeJtQLh13JiQiPBMX/qfkysW7dZVYHdHjqTOqT0JHR3akYP23GIe6T@iV85BGlfesuRcBKeBSBCKHcBa3lGELIGffGb7@jK8@19V7ww2pjHH2qUN11/z9MwTykLtdPDNmbJ1Xl0ekM5qcnVW6z@ "Ruby – Try It Online")
Function takes input as a single string like `d6f6g3` and prints output to stdout.
The idea is to find coordinates whose euclidean distance squared from all three inputs is 5. This is counted in `C`, which is reset every third iteration when `j=i%3*2` is zero. A lowercase `c` (variable) would halt execution because Ruby assumes that it may not be initialized by the time it is needed. Therefore we use an uppercase constant `C` which executes fine (but generates a warning to stderror every time it is changed.)
Input is converted from characters to ASCII codes and final result is converted back from ASCII codes to characters. As ASCII codes for `h8` are 104 and 56, there are nearly 6000 possibilities for the output. For each of these we have to check the 3 inputs so the minimum number of iterations required is a little under 20000. Code is short, but inefficient! If uppercase input is allowed, this can be reduced to just over 12000 iterations.
[Answer]
# [Desmos](https://desmos.com/calculator), 126 bytes
```
L=[-2...2]
P=[(a,b)fora=L,b=L]
A=[p+qforp=l+0P,q=P[P.x^2+P.y^2=5]]
X=A[A.x=i.x]
C=[X[X.y=i.y].lengthfori=A]
f(l)=A[C=C.max][1]
```
Takes in a list of points, with each coordinate being a charpoint, and returns a point, with each coordinate being a charpoint.
This is just a port of one of the strategies I saw while scrolling through here. It finds all possible positions that can be reached if all three pieces are treated as knights, and find the mode (most common value) of those positions. There is probably a better way to do this (maybe something more mathematical?), but I think this is fine for now.
As a bonus, I included a simple chessboard graphic so y'all can visualize the test cases :D
[Try It On Desmos!](https://www.desmos.com/calculator/jnkfm1qnkx)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/rdedssqasm)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~77~~  76 bytes idea from tsh
-1 byte from
naffetS
```
f=(a,i)=>a.some(x=>(parseInt(x,18)-i)**2%323%179^77)?f(a,-~i):i.toString(18)
```
[Try it online!](https://tio.run/##VZbNbtswEITvfQrXaAKrcAJIFEm1hdNLLznXt8BF9UPJLlo7iI0iQOC@erqcCVfyZRyR2tXOx@Uiv@q/9bF92j2ebvaHLry@9qtFvdxlq7v69nj4ExbPq7vFY/10DPf70@J5mVfZzS77@LG4MoW5yv2nH95nX3uJufm3yz7vbk@H76en3X5YyJuv63A8HVcv8zqff36YN2a@nLfFfLOc1wUWyriQRzFYNViNC43luyIltkpsxYXGMUDEYstq8sYzQMRhy@lnmooBIh5bHluW74pUWK2w6vS1BpXXJn2yQ/kNyq/L9LUultzBQwMPdVyordqzDBWBmwZu6rhQOzXqmEQEvhqrn669WvZMIgKHjdNK6krNV0wiQhPwynIsQ0VguIFhFuE0oM21PnBFVQHW22L0B@RlKijEtQAIrRn9Ab4eKUlZphMBjrYcncat8ZjJzDGxCMC0dvTsUok4etLzTCwCRK1T9@A4tgM5VkwsQu9eiYAoy7ZMJwJsLbF5rdNpfJdrp@LEUHgPdl0x9rdJh4VK@7jWg11nxk4vLxqIgC3TiYBdV47dby9aiYAdE4uAXWfHG@EumoqAPROLgF3n9JZM7lalgCsmFqF3r9dnvG@sGHWAXcc75rVOp/EB7GABR4nCB7ALYJeGxdvZodIhrg1gF4zGT@6lVcCW6UTALoBdGiXTbiNgx8QiYBfALo2XabcRsGdiEbALYJdGzrTbCLhiYhF6B7s0i1LZlulEwC6AHdM5LRHxPdjBAo4ShW/Brge7NKTezg6VbuPaFux6o/GT62wVsGU6EbDrwS6Nq2m3EbBjYhGw68EuDa5ptxGwZ2IRsOvBLo2wabcRcMXEIvQOdmmspbIt04mAXQ92TOe0RMQPYAcLOEoSGYAtjbW3Y6P7wWjA5P5aJQrPAxClwTVtKnKE0wFg0riathLpsT7gSENq2kBkBn8DIKQhlcphJbDOUKef3sI1quL12cJwmkXplmyNvja5b8i7hcM0Xsaj3@DDcau8vEdws4WbNDbGI93Abtxyk/uxgb@46t@Sn7@86w9Pi/jPxf232W4/w78Z2Uv8WeHvB@5tvuC9fHbo8U6Gx@Ly0ejjrpd336/WxfW6kB9zvTbyk8f1fvGwzpfrYrk2m@z9iumz9rA/Hn6H29@HYfHzw8s6Py9FC6g5z8LzY2hPoZt9eGHAeTkbwkkeL9Kdf2bn1/8 "JavaScript (Node.js) – Try It Online")
# [JavaScript (Node.js)](https://nodejs.org), ~~87~~ 85 bytes
```
f=(a,i=180)=>a.every(x=>/16|20|35|37/.test(parseInt(x,18)-i))?i.toString(18):f(a,-~i)
```
[Try it online!](https://tio.run/##VZZPb9pAEMXv/RQUVRGWCIm93rWVivTSS8/lFiHVf9aGKoIIUJWK0K@ezr6XHZvLI571juf9dnaU39Wf6tgcti@n292@9e/v3XJWzbfLtLxPlo/Vwv/xh7@z1@XjXeresvs3Y99Mcbc4@eNp9lIdjv7H7jR7nadlcrtNkm/bxWn/83TY7vqZhB46yXX7b5u8r@T94/I8rdLpw9O0NtP5tMmm6/m0yhDIQyANYhA1iIZAbfmuSI6lHEshUDtuELFYspq8LrhBxGHJ6WfqkhtECiwVWLJ8V6REtETU6Ws1Kq9M/GSL8muUX@Xxa20ouYWHGh6qEKis2rPcKgI3NdxUIVA5NeqYRAS@aqufrgq1XDCJCBzWTiupSjVfMokITcAry7HcKgLDNQyzCKcbmlTrA1dU5WG9yQZ/QJ7HgnyIeUBozOAP8PVIScoynQhwNPngNCwNx0xmjolFAKaxg2cXS8TRk17BxCJA1Dh1D45DO5BjycQi9F4oERBl2ZbpRICtIbZC63S6v021U3FiKLwDuzYb@tvEw0KlXYh1YNeaodPzqwYiYMt0ImDX5kP326tWImDHxCJg19rhRrirpiLggolFwK51ektGd6tUwCUTi9B7oddnuG@sGHWAXcs7VmidTvd7sIMFHCUK78HOg10cFh9nh0r7EOvBzhvdP7qXVgFbphMBOw92cZSMu42AHROLgJ0Huzhext1GwAUTi4CdB7s4csbdRsAlE4vQO9jFWRTLtkwnAnYe7JjOaYnY34EdLOAoUfgG7Dqwi0Pq4@xQ6SbENmDXGd0/us5WAVumEwG7DuziuBp3GwE7JhYBuw7s4uAadxsBF0wsAnYd2MURNu42Ai6ZWITewS6OtVi2ZToRsOvAjumcloj9PdjBAo6SRHpgi2Pt49jovje6YXR/rRKF5x6I4uAaNxU5wmkPMHFcjVuJ9FgfcMQhNW4gMoO/HhDikIrlsBJY51ann97ANari9dnAcJxF8ZZsjL42um/Iu4HDOF6Go1/jw2Epv75HcLOBmzg2hiNdw25YcqP7sYa/EC0@kl@@fur2h1n45@LH98l2N8G/Gck5/Czx9xPX1l/xXjrZd3gnwWN2/Wj0cdvJu5@Xq@xmlcmPuVkZ@UlDvJs9rdL5KpuvzDr5vGT6pNnvjvtnv3je97NfX86r9DIXzaDmMvGvL745@Xby5cwNl/mk9yd5vEp3@ZVc3v8D "JavaScript (Node.js) – Try It Online")
Discuss in base 18
[18 is only choice](https://tio.run/##VZY9b9swEIb3/IrUQyLVdlB9kBLiKl3awYuG1ksQeNAHJbsI7MA2ghRp@tfT4/uGlLyc7CPvdO/D40G/q@fq2By2T6f5bt@a925/CMoiyhfl10QvptMyfF0W13@vFxf3xU/T/3h5CoJyHofT5TQop@5ZziP3axqF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ZwPBbha5W7JJ/LbBfUPeDRS68dIf/Rovtkvp5T2Cmg3UuLHRH@kacu2SHtyPNfRZb3ZO/jG/sp879uNi8e16u7vGZ0b4bh8Ffj9xbT3Hvuh632JPiL/x5d/E/922svdLsYpvVrE8kptVIo/I@tvgaRVNV/F0lazDLwXTh/KFNZ5/XF3JhkVY73fH/bO5fd7bb6D5x@d/)
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~182~~ 170 bytes
Saved 12 bytes thanks to comment.
```
Module[{x,p,y,q,z,r,u,v,w},{x,p,y,q,z,r}=ToCharacterCode@a;x-=z;y-=z;p-=r;q-=r;u=x^2+p^2;v=y^2+q^2;w=(x*q-y*p)*2;FromCharacterCode@{⌊u*q-v* p⌋/w+z,⌊v*x-u*y⌋/w+r}]
```
[Try it online!](https://tio.run/##Vc5BCsIwEAXQvacQVxqnCFEqGAKC4E4QdFeqxDZVwdo0JG1S6QXUU3qRGnGh3Xw@j88wKVMnnjJ1jliTBGy/UfJ8PYYz2m1WWawvPLgZEGAhhwokaCigrOHfarrNFicmWaS4XGQxnzNiPFoR@wnhUUnyT2hqdngodpgU1LqWu1bSvkG5Z5EYIEyWMkvbl26v5127QYG64vV8jMphBY4KZDyN7FdkHTZr97QKkqAX@4l/HPfCsPOjSezzaYuicYIP2FHzBg)
A port of [@tsh's answer](https://codegolf.stackexchange.com/a/256856/110802).
Explicit Mathematica code
```
f[a_String] := Module[{x, p, y, q, z, r, u, v, w, char1, char2},
  {x, p, y, q, z, r} = ToCharacterCode[a];
  x -= z;
  y -= z;
  p -= r;
  q -= r;
  u = x*x + p*p;
  v = y*y + q*q;
  w = BitShiftLeft[x*q - y*p, 1];
  char1 = FromCharacterCode[Quotient[(u*q - v*p), w] + z];
  char2 = FromCharacterCode[Quotient[(v*x - u*y), w] + r];
  StringJoin[char1, char2]
]
```
[Answer]
# [Nekomata](https://github.com/AlephAlpha/Nekomata), 13 bytes
```
eᵐ{2R↕ᵐᶜ_+}≡H
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iLzU7PzexJHFZtJJurlLsgqWlJWm6FttTH26dUG0U9KhtKpDxcNuceO3aR50LPZYUJyUXQ9UsuGkUrZRipqSjlAYi0o2VYrmAAiZANlg01RwskGwMUmEEJJKMlGIhWgE)
```
eᵐ{2R↕ᵐᶜ_+}≡H
e               Char to codepoint
 ᵐ{       }     Map
   2R↕ᵐᶜ_       Any of the 8 knight moves
         +      Add
           ≡    Check if all equal
            H   Char from codepoint
```
The `2R↕ᵐᶜ_` part is taken from [my answer to the challenge *Generate All 8 Knight's Moves*](https://codegolf.stackexchange.com/a/260297/9288).
]