bachelor_thesis/computations/C_L_as_circuits.ipynb

1631 lines
67 KiB
Plaintext
Raw Permalink Normal View History

2019-12-31 15:03:41 +00:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Elements of $C_L$ as meaningful circuits"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAADFcAAAA/CAYAAACfdcacAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4Ae2djdXURrKGgeMAvL4Z4AzAG8FCBrAbgXEG5jgCDs4AHMFeyMBsBDZkYDJYXzLwrZpPGvVILan/u7rq1Tn6PqnVP1VPvd0tzUij+/fu3XtC66+0rpfPf/3117frxPv370flX5fHfhkCFIePVNMjT23PKW7vPelIAgGTBDBmjRd2ieMbdCRbRxI1I5uYHevQd/vEWmKfhBb6aMFtVaIuXPuw3Z4A+mV75jEtSuuz0EtM9NrnlaYXJgDNtNdBbosSdZTrE8qDQA0CGN9qUI2vE2NWPLNRSqCPjRKpWzvRJ295YA8EQAAELBHA3K072pjjdccX3oEACJQngHmxPNMRapQ2X0KHI6hGr42x/eEo/1cOpqfONm/+udpf78bmX5fHfh6B76n4N6sqfA/JrLJgFwTMEsCYNU7oJY9v0JFMHUnWjExi9qxC320bc8l9ElpoqwW3Ncm6cO3EdnsC6JftmYe0KLXPQi8h0WufR6pemAQ0014PqS1K1lGqTygHAjUJYHyrSfe8boxZ54xGz4E+NlYE0SfHihesBQEQAIEaBDB316Dav07M8f1jAAtAAATGJIB5ccy4pVotdb6EDlMjinI5BGL7w27+68MV9LaDDzEWxeYPqZueAvnrLB+1e/8sj8Tj5Ns7suvZmW2h/lG+T+u6qI0v6zTsgwAI3BGoMWbNbEv377le6f9rjdmSx7fSOtKunVb+SdaM9H5sxb7SfXfNrZXW1+3W2C8xtkvuk6W1oCn2KXqK8V+yLlJ8R5lyBEr3S9eyGI265TRux7KQ2mdr6CWWjTZ9kP/Zn8V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\sqrt{2}}{2}\\\\\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & i\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & 1\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\\\\\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & -1\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2} i}{2} & \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\\\\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}1 & 0\\\\0 & - i\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\\\\\frac{\\sqrt{2} i}{2} & \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} + \\frac{i}{2} & \\frac{1}{2} - \\frac{i}{2}\\\\\\frac{1}{2} - \\frac{i}{2} & \\frac{1}{2} + \\frac{i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\\\- \\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & 1\\\\1 & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\\\- \\frac{\\sqrt{2} i}{2} & \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & 1\\\\i & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} - \\frac{i}{2} & \\frac{1}{2} + \\frac{i}{2}\\\\- \\frac{1}{2} + \\frac{i}{2} & \\frac{1}{2} + \\frac{i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & i\\\\1 & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\\\- \\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} - \\frac{i}{2} & - \\frac{1}{2} + \\frac{i}{2}\\\\- \\frac{1}{2} + \\frac{i}{2} & - \\frac{1}{2} + \\frac{i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}0 & -1\\\\1 & 0\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\\\- \\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2} i}{2}\\end{matrix}\\right], \\ \\left[\\begin{matrix}\\frac{1}{2} - \\frac{i}{2} & \\frac{i \\left(-1 + i\\right)}{2}\\\\- \\frac{1}{2} + \\frac{i}{2} & \\frac{i \\left(-1 + i\\right)}{2}\\end{matrix}\\right]\\right]$"
],
"text/plain": [
"⎡⎡√2 √2 ⎤ ⎡ √2 √2 ⎤ ⎡√2 √2⋅ ⎤ ⎡ √2 √2⋅\n",
"⎢⎢── ── ⎥ ⎢ ── ── ⎥ ⎢── ──── ⎥ ⎢ ── ───\n",
"⎢⎢2 2 ⎥ ⎡1 0⎤ ⎡1 0⎤ ⎢ 2 2 ⎥ ⎢2 2 ⎥ ⎡1 0 ⎤ ⎢ 2 2 \n",
"⎢⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
"⎢⎢√2 -√2 ⎥ ⎣0 ⅈ⎦ ⎣0 1⎦ ⎢√2⋅ -√2⋅ ⎥ ⎢√2 -√2⋅ ⎥ ⎣0 -1⎦ ⎢√2⋅ √2\n",
"⎢⎢── ────⎥ ⎢──── ──────⎥ ⎢── ──────⎥ ⎢──── ──\n",
"⎣⎣2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 ⎦ ⎣ 2 2 \n",
"\n",
"ⅈ⎤ ⎡√2 -√2 ⎤ ⎡ √2 -√2 ⎤ ⎡√2 -√2⋅ ⎤ ⎡ √2 -√2⋅ ⎤ ⎡1 1\n",
"─⎥ ⎢── ────⎥ ⎢ ── ────⎥ ⎢── ──────⎥ ⎢ ── ──────⎥ ⎢─ + ─ ─\n",
" ⎥ ⎢2 2 ⎥ ⎡1 0 ⎤ ⎢ 2 2 ⎥ ⎢2 2 ⎥ ⎢ 2 2 ⎥ ⎢2 2 2\n",
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
" ⎥ ⎢√2 √2 ⎥ ⎣0 -ⅈ⎦ ⎢√2⋅ √2⋅⎥ ⎢√2 √2⋅ ⎥ ⎢√2⋅ -√2 ⎥ ⎢1 1\n",
" ⎥ ⎢── ── ⎥ ⎢──── ────⎥ ⎢── ──── ⎥ ⎢──── ──── ⎥ ⎢─ - ─ ─\n",
" ⎦ ⎣2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 ⎦ ⎣ 2 2 ⎦ ⎣2 2 2\n",
"\n",
" ⅈ⎤ ⎡ √2 √2⎤ ⎡ √2 √2 ⎤ ⎡ 1 1 ⅈ⎤ ⎡\n",
" - ─⎥ ⎢ ── ──⎥ ⎢ ── ── ⎥ ⎢ ─ - ─ ─ + ─⎥ ⎢\n",
" 2⎥ ⎢ 2 2 ⎥ ⎡0 1⎤ ⎢ 2 2 ⎥ ⎡0 1⎤ ⎢ 2 2 2 2⎥ ⎡0 ⅈ⎤ ⎢\n",
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢\n",
" ⅈ⎥ ⎢-√2 √2⎥ ⎣1 0⎦ ⎢-√2⋅ √2⋅⎥ ⎣ⅈ 0⎦ ⎢ 1 1 ⅈ⎥ ⎣1 0⎦ ⎢\n",
" + ─⎥ ⎢──── ──⎥ ⎢────── ────⎥ ⎢- ─ + ─ ─ + ─⎥ ⎢\n",
" 2⎦ ⎣ 2 2 ⎦ ⎣ 2 2 ⎦ ⎣ 2 2 2 2⎦ ⎣\n",
"\n",
" √2 √2⋅⎤ ⎡ 1 1 ⅈ⎤ ⎡ √2 -√2 ⎤ ⎡ 1 ⅈ⋅(-1 \n",
" ── ────⎥ ⎢ ─ - ─ - ─ + ─⎥ ⎢ ── ──── ⎥ ⎢ ─ - ─ ──────\n",
" 2 2 ⎥ ⎢ 2 2 2 2⎥ ⎡0 -1⎤ ⎢ 2 2 ⎥ ⎢ 2 2 2 \n",
" ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ \n",
"-√2⋅ -√2 ⎥ ⎢ 1 1 ⅈ⎥ ⎣1 0 ⎦ ⎢-√2⋅ -√2⋅ ⎥ ⎢ 1 ⅈ⋅(-1 \n",
"────── ────⎥ ⎢- ─ + ─ - ─ + ─⎥ ⎢────── ──────⎥ ⎢- ─ + ─ ──────\n",
" 2 2 ⎦ ⎣ 2 2 2 2⎦ ⎣ 2 2 ⎦ ⎣ 2 2 2 \n",
"\n",
"+ )⎤⎤\n",
"────⎥⎥\n",
" ⎥⎥\n",
" ⎥⎥\n",
"+ )⎥⎥\n",
"────⎥⎥\n",
" ⎦⎦"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sympy\n",
"\n",
"M = sympy.Matrix\n",
"simplify = sympy.simplify\n",
"sqrt = sympy.sqrt\n",
"i = sympy.I\n",
"\n",
"from sympy.physics.quantum import Dagger\n",
"\n",
"sympy.init_printing()\n",
"H = simplify(M([[1, 1], [1, -1]]) / sqrt(2))\n",
"S = M([[1, 0], [0, i]])\n",
"C_L = [H, S]\n",
"basis_vectors = [M([1, 0]), M([0, 1])]\n",
"\n",
"def getitem(m, i, j):\n",
" # Note that sympy uses an extremely weird way to store the matrices,\n",
" # in particular the internal representation is vastly different from what\n",
" # is printed. For instance the H matrix is stored as a Mul object\n",
" # (even after using simplify) instead of a matrix. \n",
" # Therefore m[i][j] will NOT work. This is a workaround.\n",
" return (Dagger(basis_vectors[i]) * m * basis_vectors[j])[0]\n",
"\n",
"def is_known(C_L, a):\n",
" for c in C_L:\n",
" test = c * Dagger(a)\n",
" if(simplify(getitem(test, 0, 1)) != 0):\n",
" continue\n",
" if(simplify(getitem(test, 0, 0) / getitem(test, 1, 1)) == 1):\n",
" return True\n",
" return False\n",
"for i in range(5):\n",
" for m in (H, S):\n",
" for c in C_L:\n",
" c = simplify(c*m)\n",
" if(is_known(C_L, c)):\n",
" continue\n",
" C_L.append(c)\n",
"C_L"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"X = M([[0, 1], [1, 0]])\n",
"Z = M([[1, 0], [0, -1]])\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"s2m = {\"H\": H, \"S\": S, \"X\": X, \"Z\": Z}\n",
"def eval_str(s):\n",
" result = M([[1, 0], [0, 1]])\n",
" for c in s:\n",
" result *= s2m[c]\n",
" return result"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def get_product_index(a):\n",
" for i,c in enumerate(C_L):\n",
" test = c * Dagger(a)\n",
" if(simplify(getitem(test, 0, 1)) != 0):\n",
" continue\n",
" if(simplify(getitem(test, 0, 0) / getitem(test, 1, 1)) == 1):\n",
" return i\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from itertools import product\n",
"from collections import defaultdict\n",
"\n",
"results = defaultdict(set)\n",
"\n",
"def recursive_xs_products(length):\n",
" if(length == 1):\n",
" yield \"H\"\n",
" yield \"S\"\n",
" yield \"X\"\n",
" yield \"Z\"\n",
" else:\n",
" for p in recursive_xs_products(length - 1):\n",
" yield p\n",
" yield p + \"H\"\n",
" yield p + \"S\"\n",
" yield p + \"X\"\n",
" yield p + \"Z\"\n",
" \n",
" \n",
"for p in recursive_xs_products(5):\n",
" results[get_product_index(eval_str(p))] |= {p}\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"defaultdict(set,\n",
" {0: {'H',\n",
" 'HHH',\n",
" 'HHHHH',\n",
" 'HHHXX',\n",
" 'HHHZZ',\n",
" 'HHXHZ',\n",
" 'HHXXH',\n",
" 'HHZHX',\n",
" 'HHZZH',\n",
" 'HSSSS',\n",
" 'HSSZ',\n",
" 'HSXSX',\n",
" 'HSZS',\n",
" 'HXHHX',\n",
" 'HXHZH',\n",
" 'HXSXS',\n",
" 'HXX',\n",
" 'HXXHH',\n",
" 'HXXXX',\n",
" 'HXXZZ',\n",
" 'HXZXZ',\n",
" 'HXZZX',\n",
" 'HZHHZ',\n",
" 'HZHXH',\n",
" 'HZSS',\n",
" 'HZXXZ',\n",
" 'HZXZX',\n",
" 'HZZ',\n",
" 'HZZHH',\n",
" 'HZZXX',\n",
" 'HZZZZ',\n",
" 'SHSHS',\n",
" 'SSHX',\n",
" 'SSSSH',\n",
" 'SSZH',\n",
" 'SXSHZ',\n",
" 'SXSXH',\n",
" 'SZSH',\n",
" 'XHHHZ',\n",
" 'XHHXH',\n",
" 'XHSS',\n",
" 'XHXXZ',\n",
" 'XHXZX',\n",
" 'XHZ',\n",
" 'XHZHH',\n",
" 'XHZXX',\n",
" 'XHZZZ',\n",
" 'XSXSH',\n",
" 'XXH',\n",
" 'XXHHH',\n",
" 'XXHXX',\n",
" 'XXHZZ',\n",
" 'XXXHZ',\n",
" 'XXXXH',\n",
" 'XXZHX',\n",
" 'XXZZH',\n",
" 'XZHXZ',\n",
" 'XZHZX',\n",
" 'XZXHX',\n",
" 'XZXZH',\n",
" 'XZZHZ',\n",
" 'XZZXH',\n",
" 'ZHHHX',\n",
" 'ZHHZH',\n",
" 'ZHSXS',\n",
" 'ZHX',\n",
" 'ZHXHH',\n",
" 'ZHXXX',\n",
" 'ZHXZZ',\n",
" 'ZHZXZ',\n",
" 'ZHZZX',\n",
" 'ZSSH',\n",
" 'ZXHXZ',\n",
" 'ZXHZX',\n",
" 'ZXXHX',\n",
" 'ZXXZH',\n",
" 'ZXZHZ',\n",
" 'ZXZXH',\n",
" 'ZZH',\n",
" 'ZZHHH',\n",
" 'ZZHXX',\n",
" 'ZZHZZ',\n",
" 'ZZXHZ',\n",
" 'ZZXXH',\n",
" 'ZZZHX',\n",
" 'ZZZZH'},\n",
" 2: {'HH',\n",
" 'HHHH',\n",
" 'HHSSZ',\n",
" 'HHSZS',\n",
" 'HHXX',\n",
" 'HHZSS',\n",
" 'HHZZ',\n",
" 'HSSHX',\n",
" 'HSSZH',\n",
" 'HSZSH',\n",
" 'HXHSS',\n",
" 'HXHZ',\n",
" 'HXXH',\n",
" 'HZHX',\n",
" 'HZSSH',\n",
" 'HZZH',\n",
" 'SHHSZ',\n",
" 'SHHZS',\n",
" 'SHXHS',\n",
" 'SSHHZ',\n",
" 'SSHXH',\n",
" 'SSSS',\n",
" 'SSXXZ',\n",
" 'SSXZX',\n",
" 'SSZ',\n",
" 'SSZHH',\n",
" 'SSZXX',\n",
" 'SSZZZ',\n",
" 'SXSX',\n",
" 'SXXSZ',\n",
" 'SXXZS',\n",
" 'SXZXS',\n",
" 'SZHHS',\n",
" 'SZS',\n",
" 'SZSHH',\n",
" 'SZSXX',\n",
" 'SZSZZ',\n",
" 'SZXXS',\n",
" 'SZZSZ',\n",
" 'SZZZS',\n",
" 'XHHX',\n",
" 'XHSSH',\n",
" 'XHZH',\n",
" 'XSSXZ',\n",
" 'XSSZX',\n",
" 'XSXS',\n",
" 'XSZSX',\n",
" 'XX',\n",
" 'XXHH',\n",
" 'XXSSZ',\n",
" 'XXSZS',\n",
" 'XXXX',\n",
" 'XXZSS',\n",
" 'XXZZ',\n",
" 'XZSSX',\n",
" 'XZXSS',\n",
" 'XZXZ',\n",
" 'XZZX',\n",
" 'ZHHSS',\n",
" 'ZHHZ',\n",
" 'ZHXH',\n",
" 'ZSHHS',\n",
" 'ZSS',\n",
" 'ZSSHH',\n",
" 'ZSSXX',\n",
" 'ZSSZZ',\n",
" 'ZSXXS',\n",
" 'ZSZSZ',\n",
" 'ZSZZS',\n",
" 'ZXSSX',\n",
" 'ZXXSS',\n",
" 'ZXXZ',\n",
" 'ZXZX',\n",
" 'ZZ',\n",
" 'ZZHH',\n",
" 'ZZSSZ',\n",
" 'ZZSZS',\n",
" 'ZZXX',\n",
" 'ZZZSS',\n",
" 'ZZZZ'},\n",
" 4: {'HHHS',\n",
" 'HS',\n",
" 'HSHH',\n",
" 'HSSSZ',\n",
" 'HSSZS',\n",
" 'HSXX',\n",
" 'HSZSS',\n",
" 'HSZZ',\n",
" 'HXSXZ',\n",
" 'HXSZX',\n",
" 'HXXS',\n",
" 'HXZSX',\n",
" 'HZSSS',\n",
" 'HZSZ',\n",
" 'HZXSX',\n",
" 'HZZS',\n",
" 'SHSHZ',\n",
" 'SHSXH',\n",
" 'SSHXS',\n",
" 'SSZHS',\n",
" 'SZSHS',\n",
" 'XHSSS',\n",
" 'XHSZ',\n",
" 'XHXSX',\n",
" 'XHZS',\n",
" 'XSHSH',\n",
" 'XXHS',\n",
" 'XZHSX',\n",
" 'ZHSXZ',\n",
" 'ZHSZX',\n",
" 'ZHXS',\n",
" 'ZHZSX',\n",
" 'ZSSHS',\n",
" 'ZXHSX',\n",
" 'ZZHS'},\n",
" 13: {'HHHX',\n",
" 'HHSSH',\n",
" 'HHZH',\n",
" 'HSSXZ',\n",
" 'HSSZX',\n",
" 'HSXS',\n",
" 'HSZSX',\n",
" 'HX',\n",
" 'HXHH',\n",
" 'HXSSZ',\n",
" 'HXSZS',\n",
" 'HXXX',\n",
" 'HXZSS',\n",
" 'HXZZ',\n",
" 'HZSSX',\n",
" 'HZXSS',\n",
" 'HZXZ',\n",
" 'HZZX',\n",
" 'SHHSH',\n",
" 'SSH',\n",
" 'SSHHH',\n",
" 'SSHXX',\n",
" 'SSHZZ',\n",
" 'SSXHZ',\n",
" 'SSXXH',\n",
" 'SSZHX',\n",
" 'SSZZH',\n",
" 'SXXSH',\n",
" 'SZSHX',\n",
" 'SZSZH',\n",
" 'SZZSH',\n",
" 'XHSSX',\n",
" 'XHXSS',\n",
" 'XHXZ',\n",
" 'XHZX',\n",
" 'XSSHZ',\n",
" 'XSSXH',\n",
" 'XXHX',\n",
" 'XXSSH',\n",
" 'XXZH',\n",
" 'XZHSS',\n",
" 'XZHZ',\n",
" 'XZXH',\n",
" 'ZH',\n",
" 'ZHHH',\n",
" 'ZHSSZ',\n",
" 'ZHSZS',\n",
" 'ZHXX',\n",
" 'ZHZSS',\n",
" 'ZHZZ',\n",
" 'ZSSHX',\n",
" 'ZSSZH',\n",
" 'ZSZSH',\n",
" 'ZXHSS',\n",
" 'ZXHZ',\n",
" 'ZXXH',\n",
" 'ZZHX',\n",
" 'ZZSSH',\n",
" 'ZZZH'},\n",
" 7: {'HHHSS',\n",
" 'HHHZ',\n",
" 'HHXH',\n",
" 'HSHHS',\n",
" 'HSS',\n",
" 'HSSHH',\n",
" 'HSSXX',\n",
" 'HSSZZ',\n",
" 'HSXXS',\n",
" 'HSZSZ',\n",
" 'HSZZS',\n",
" 'HXSSX',\n",
" 'HXXSS',\n",
" 'HXXZ',\n",
" 'HXZX',\n",
" 'HZ',\n",
" 'HZHH',\n",
" 'HZSSZ',\n",
" 'HZSZS',\n",
" 'HZXX',\n",
" 'HZZSS',\n",
" 'HZZZ',\n",
" 'SSHXZ',\n",
" 'SSHZX',\n",
" 'SSXHX',\n",
" 'SSXZH',\n",
" 'SSZHZ',\n",
" 'SSZXH',\n",
" 'SXSH',\n",
" 'SZSHZ',\n",
" 'SZSXH',\n",
" 'XH',\n",
" 'XHHH',\n",
" 'XHSSZ',\n",
" 'XHSZS',\n",
" 'XHXX',\n",
" 'XHZSS',\n",
" 'XHZZ',\n",
" 'XSSHX',\n",
" 'XSSZH',\n",
" 'XSZSH',\n",
" 'XXHSS',\n",
" 'XXHZ',\n",
" 'XXXH',\n",
" 'XZHX',\n",
" 'XZSSH',\n",
" 'XZZH',\n",
" 'ZHSSX',\n",
" 'ZHXSS',\n",
" 'ZHXZ',\n",
" 'ZHZX',\n",
" 'ZSSHZ',\n",
" 'ZSSXH',\n",
" 'ZXHX',\n",
" 'ZXSSH',\n",
" 'ZXZH',\n",
" 'ZZHSS',\n",
" 'ZZHZ',\n",
" 'ZZXH'},\n",
" 1: {'HHHHS',\n",
" 'HHS',\n",
" 'HHSHH',\n",
" 'HHSXX',\n",
" 'HHSZZ',\n",
" 'HHXXS',\n",
" 'HHZSZ',\n",
" 'HHZZS',\n",
" 'HXHSZ',\n",
" 'HXHZS',\n",
" 'HXXHS',\n",
" 'HZHXS',\n",
" 'HZZHS',\n",
" 'S',\n",
" 'SHH',\n",
" 'SHHHH',\n",
" 'SHHXX',\n",
" 'SHHZZ',\n",
" 'SHXHZ',\n",
" 'SHXXH',\n",
" 'SHZHX',\n",
" 'SHZZH',\n",
" 'SSSSS',\n",
" 'SSSZ',\n",
" 'SSXSX',\n",
" 'SSZS',\n",
" 'SXHHX',\n",
" 'SXHZH',\n",
" 'SXSXS',\n",
" 'SXX',\n",
" 'SXXHH',\n",
" 'SXXXX',\n",
" 'SXXZZ',\n",
" 'SXZXZ',\n",
" 'SXZZX',\n",
" 'SZHHZ',\n",
" 'SZHXH',\n",
" 'SZSS',\n",
" 'SZXXZ',\n",
" 'SZXZX',\n",
" 'SZZ',\n",
" 'SZZHH',\n",
" 'SZZXX',\n",
" 'SZZZZ',\n",
" 'XHHXS',\n",
" 'XHZHS',\n",
" 'XSSSX',\n",
" 'XSXSS',\n",
" 'XSXZ',\n",
" 'XSZX',\n",
" 'XXHHS',\n",
" 'XXS',\n",
" 'XXSHH',\n",
" 'XXSXX',\n",
" 'XXSZZ',\n",
" 'XXXXS',\n",
" 'XXZSZ',\n",
" 'XXZZS',\n",
" 'XZSX',\n",
" 'XZXSZ',\n",
" 'XZXZS',\n",
" 'XZZXS',\n",
" 'ZHHSZ',\n",
" 'ZHHZS',\n",
" 'ZHXHS',\n",
" 'ZSHHZ',\n",
" 'ZSHXH',\n",
" 'ZSSS',\n",
" 'ZSXXZ',\n",
" 'ZSXZX',\n",
" 'ZSZ',\n",
" 'ZSZHH',\n",
" 'ZSZXX',\n",
" 'ZSZZZ',\n",
" 'ZXSX',\n",
" 'ZXXSZ',\n",
" 'ZXXZS',\n",
" 'ZXZXS',\n",
" 'ZZHHS',\n",
" 'ZZS',\n",
" 'ZZSHH',\n",
" 'ZZSXX',\n",
" 'ZZSZZ',\n",
" 'ZZXXS',\n",
" 'ZZZSZ',\n",
" 'ZZZZS'},\n",
" 14: {'HHHHX',\n",
" 'HHHZH',\n",
" 'HHSXS',\n",
" 'HHX',\n",
" 'HHXHH',\n",
" 'HHXXX',\n",
" 'HHXZZ',\n",
" 'HHZXZ',\n",
" 'HHZZX',\n",
" 'HSSH',\n",
" 'HXHXZ',\n",
" 'HXHZX',\n",
" 'HXXHX',\n",
" 'HXXZH',\n",
" 'HXZHZ',\n",
" 'HXZXH',\n",
" 'HZH',\n",
" 'HZHHH',\n",
" 'HZHXX',\n",
" 'HZHZZ',\n",
" 'HZXHZ',\n",
" 'HZXXH',\n",
" 'HZZHX',\n",
" 'HZZZH',\n",
" 'SHHXS',\n",
" 'SHZHS',\n",
" 'SSSSX',\n",
" 'SSXSS',\n",
" 'SSXZ',\n",
" 'SSZX',\n",
" 'SXHHS',\n",
" 'SXS',\n",
" 'SXSHH',\n",
" 'SXSXX',\n",
" 'SXSZZ',\n",
" 'SXXXS',\n",
" 'SXZSZ',\n",
" 'SXZZS',\n",
" 'SZSX',\n",
" 'SZXSZ',\n",
" 'SZXZS',\n",
" 'SZZXS',\n",
" 'X',\n",
" 'XHH',\n",
" 'XHHHH',\n",
" 'XHHXX',\n",
" 'XHHZZ',\n",
" 'XHXHZ',\n",
" 'XHXXH',\n",
" 'XHZHX',\n",
" 'XHZZH',\n",
" 'XSSSS',\n",
" 'XSSZ',\n",
" 'XSXSX',\n",
" 'XSZS',\n",
" 'XXHHX',\n",
" 'XXHZH',\n",
" 'XXSXS',\n",
" 'XXX',\n",
" 'XXXHH',\n",
" 'XXXXX',\n",
" 'XXXZZ',\n",
" 'XXZXZ',\n",
" 'XXZZX',\n",
" 'XZHHZ',\n",
" 'XZHXH',\n",
" 'XZSS',\n",
" 'XZXXZ',\n",
" 'XZXZX',\n",
" 'XZZ',\n",
" 'XZZHH',\n",
" 'XZZXX',\n",
" 'XZZZZ',\n",
" 'ZHHXZ',\n",
" 'ZHHZX',\n",
" 'ZHXHX',\n",
" 'ZHXZH',\n",
" 'ZHZHZ',\n",
" 'ZHZXH',\n",
" 'ZSSX',\n",
" 'ZSXSZ',\n",
" 'ZSXZS',\n",
" 'ZSZXS',\n",
" 'ZXHHZ',\n",
" 'ZXHXH',\n",
" 'ZXSS',\n",
" 'ZXXXZ',\n",
" 'ZXXZX',\n",
" 'ZXZ',\n",
" 'ZXZHH',\n",
" 'ZXZXX',\n",
" 'ZXZZZ',\n",
" 'ZZHHX',\n",
" 'ZZHZH',\n",
" 'ZZSXS',\n",
" 'ZZX',\n",
" 'ZZXHH',\n",
" 'ZZXXX',\n",
" 'ZZXZZ',\n",
" 'ZZZXZ',\n",
" 'ZZZZX'},\n",
" 5: {'HHHHZ',\n",
" 'HHHXH',\n",
" 'HHSS',\n",
" 'HHXXZ',\n",
" 'HHXZX',\n",
" 'HHZ',\n",
" 'HHZHH',\n",
" 'HHZXX',\n",
" 'HHZZZ',\n",
" 'HSXSH',\n",
" 'HXH',\n",
" 'HXHHH',\n",
" 'HXHXX',\n",
" 'HXHZZ',\n",
" 'HXXHZ',\n",
" 'HXXXH',\n",
" 'HXZHX',\n",
" 'HXZZH',\n",
" 'HZHXZ',\n",
" 'HZHZX',\n",
" 'HZXHX',\n",
" 'HZXZH',\n",
" 'HZZHZ',\n",
" 'HZZXH',\n",
" 'SHHS',\n",
" 'SS',\n",
" 'SSHH',\n",
" 'SSSSZ',\n",
" 'SSSZS',\n",
" 'SSXX',\n",
" 'SSZSS',\n",
" 'SSZZ',\n",
" 'SXSXZ',\n",
" 'SXSZX',\n",
" 'SXXS',\n",
" 'SXZSX',\n",
" 'SZSSS',\n",
" 'SZSZ',\n",
" 'SZXSX',\n",
" 'SZZS',\n",
" 'XHHXZ',\n",
" 'XHHZX',\n",
" 'XHXHX',\n",
" 'XHXZH',\n",
" 'XHZHZ',\n",
" 'XHZXH',\n",
" 'XSSX',\n",
" 'XSXSZ',\n",
" 'XSXZS',\n",
" 'XSZXS',\n",
" 'XXHHZ',\n",
" 'XXHXH',\n",
" 'XXSS',\n",
" 'XXXXZ',\n",
" 'XXXZX',\n",
" 'XXZ',\n",
" 'XXZHH',\n",
" 'XXZXX',\n",
" 'XXZZZ',\n",
" 'XZHHX',\n",
" 'XZHZH',\n",
" 'XZSXS',\n",
" 'XZX',\n",
" 'XZXHH',\n",
" 'XZX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
" 'HSZZX',\n",
" 'HXSSS',\n",
" 'HXSZ',\n",
" 'HXXSX',\n",
" 'HXZS',\n",
" 'HZSXZ',\n",
" 'HZSZX',\n",
" 'HZXS',\n",
" 'HZZSX',\n",
" 'SHXSH',\n",
" 'SSHSZ',\n",
" 'SSHZS',\n",
" 'SSXHS',\n",
" 'SZHSH',\n",
" 'XHSXZ',\n",
" 'XHSZX',\n",
" 'XHXS',\n",
" 'XHZSX',\n",
" 'XSSHS',\n",
" 'XXHSX',\n",
" 'XZHS',\n",
" 'ZHSSS',\n",
" 'ZHSZ',\n",
" 'ZHXSX',\n",
" 'ZHZS',\n",
" 'ZSHSH',\n",
" 'ZXHS',\n",
" 'ZZHSX'},\n",
" 10: {'HHHSZ',\n",
" 'HHHZS',\n",
" 'HHXHS',\n",
" 'HSHHZ',\n",
" 'HSHXH',\n",
" 'HSSS',\n",
" 'HSXXZ',\n",
" 'HSXZX',\n",
" 'HSZ',\n",
" 'HSZHH',\n",
" 'HSZXX',\n",
" 'HSZZZ',\n",
" 'HXSX',\n",
" 'HXXSZ',\n",
" 'HXXZS',\n",
" 'HXZXS',\n",
" 'HZHHS',\n",
" 'HZS',\n",
" 'HZSHH',\n",
" 'HZSXX',\n",
" 'HZSZZ',\n",
" 'HZXXS',\n",
" 'HZZSZ',\n",
" 'HZZZS',\n",
" 'SHSH',\n",
" 'SSHSX',\n",
" 'SXSHS',\n",
" 'XHHHS',\n",
" 'XHS',\n",
" 'XHSHH',\n",
" 'XHSXX',\n",
" 'XHSZZ',\n",
" 'XHXXS',\n",
" 'XHZSZ',\n",
" 'XHZZS',\n",
" 'XXHSZ',\n",
" 'XXHZS',\n",
" 'XXXHS',\n",
" 'XZHXS',\n",
" 'XZZHS',\n",
" 'ZHSX',\n",
" 'ZHXSZ',\n",
" 'ZHXZS',\n",
" 'ZHZXS',\n",
" 'ZXHXS',\n",
" 'ZXZHS',\n",
" 'ZZHSZ',\n",
" 'ZZHZS',\n",
" 'ZZXHS'},\n",
" 17: {'HHHXS',\n",
" 'HHZHS',\n",
" 'HSSSX',\n",
" 'HSXSS',\n",
" 'HSXZ',\n",
" 'HSZX',\n",
" 'HXHHS',\n",
" 'HXS',\n",
" 'HXSHH',\n",
" 'HXSXX',\n",
" 'HXSZZ',\n",
" 'HXXXS',\n",
" 'HXZSZ',\n",
" 'HXZZS',\n",
" 'HZSX',\n",
" 'HZXSZ',\n",
" 'HZXZS',\n",
" 'HZZXS',\n",
" 'SHSHX',\n",
" 'SHSZH',\n",
" 'SHZSH',\n",
" 'SSHS',\n",
" 'SXHSH',\n",
" 'XHSX',\n",
" 'XHXSZ',\n",
" 'XHXZS',\n",
" 'XHZXS',\n",
" 'XXHXS',\n",
" 'XXZHS',\n",
" 'XZHSZ',\n",
" 'XZHZS',\n",
" 'XZXHS',\n",
" 'ZHHHS',\n",
" 'ZHS',\n",
" 'ZHSHH',\n",
" 'ZHSXX',\n",
" 'ZHSZZ',\n",
" 'ZHXXS',\n",
" 'ZHZSZ',\n",
" 'ZHZZS',\n",
" 'ZXHSZ',\n",
" 'ZXHZS',\n",
" 'ZXXHS',\n",
" 'ZZHXS',\n",
" 'ZZZHS'},\n",
" 20: {'HHHXZ',\n",
" 'HHHZX',\n",
" 'HHXHX',\n",
" 'HHXZH',\n",
" 'HHZHZ',\n",
" 'HHZXH',\n",
" 'HSSX',\n",
" 'HSXSZ',\n",
" 'HSXZS',\n",
" 'HSZXS',\n",
" 'HXHHZ',\n",
" 'HXHXH',\n",
" 'HXSS',\n",
" 'HXXXZ',\n",
" 'HXXZX',\n",
" 'HXZ',\n",
" 'HXZHH',\n",
" 'HXZXX',\n",
" 'HXZZZ',\n",
" 'HZHHX',\n",
" 'HZHZH',\n",
" 'HZSXS',\n",
" 'HZX',\n",
" 'HZXHH',\n",
" 'HZXXX',\n",
" 'HZXZZ',\n",
" 'HZZXZ',\n",
" 'HZZZX',\n",
" 'SSHSS',\n",
" 'SSHZ',\n",
" 'SSXH',\n",
" 'SXSHX',\n",
" 'SXSZH',\n",
" 'SXZSH',\n",
" 'SZXSH',\n",
" 'XHHHX',\n",
" 'XHHZH',\n",
" 'XHSXS',\n",
" 'XHX',\n",
" 'XHXHH',\n",
" 'XHXXX',\n",
" 'XHXZZ',\n",
" 'XHZXZ',\n",
" 'XHZZX',\n",
" 'XSSH',\n",
" 'XXHXZ',\n",
" 'XXHZX',\n",
" 'XXXHX',\n",
" 'XXXZH',\n",
" 'XXZHZ',\n",
" 'XXZXH',\n",
" 'XZH',\n",
" 'XZHHH',\n",
" 'XZHXX',\n",
" 'XZHZZ',\n",
" 'XZXHZ',\n",
" 'XZXXH',\n",
" 'XZZHX',\n",
" 'XZZZH',\n",
" 'ZHHHZ',\n",
" 'ZHHXH',\n",
" 'ZHSS',\n",
" 'ZHXXZ',\n",
" 'ZHXZX',\n",
" 'ZHZ',\n",
" 'ZHZHH',\n",
" 'ZHZXX',\n",
" 'ZHZZZ',\n",
" 'ZSXSH',\n",
" 'ZXH',\n",
" 'ZXHHH',\n",
" 'ZXHXX',\n",
" 'ZXHZZ',\n",
" 'ZXXHZ',\n",
" 'ZXXXH',\n",
" 'ZXZHX',\n",
" 'ZXZZH',\n",
" 'ZZHXZ',\n",
" 'ZZHZX',\n",
" 'ZZXHX',\n",
" 'ZZXZH',\n",
" 'ZZZHZ',\n",
" 'ZZZXH'},\n",
" 3: {'HHSH',\n",
" 'HSHSX',\n",
" 'HXSHS',\n",
" 'SH',\n",
" 'SHHH',\n",
" 'SHSSZ',\n",
" 'SHSZS',\n",
" 'SHXX',\n",
" 'SHZSS',\n",
" 'SHZZ',\n",
" 'SSSHX',\n",
" 'SSSZH',\n",
" 'SSZSH',\n",
" 'SXHSS',\n",
" 'SXHZ',\n",
" 'SXXH',\n",
" 'SZHX',\n",
" 'SZSSH',\n",
" 'SZZH',\n",
" 'XSHXZ',\n",
" 'XSHZX',\n",
" 'XSXHX',\n",
" 'XSXZH',\n",
" 'XSZHZ',\n",
" 'XSZXH',\n",
" 'XXSH',\n",
" 'XZSHZ',\n",
" 'XZSXH',\n",
" 'ZHSHS',\n",
" 'ZSHX',\n",
" 'ZSSSH',\n",
" 'ZSZH',\n",
" 'ZXSHZ',\n",
" 'ZXSXH',\n",
" 'ZZSH'},\n",
" 16: {'HHSX',\n",
" 'HHXSZ',\n",
" 'HHXZS',\n",
" 'HHZXS',\n",
" 'HXHXS',\n",
" 'HXZHS',\n",
" 'HZHSZ',\n",
" 'HZHZS',\n",
" 'HZXHS',\n",
" 'SHHX',\n",
" 'SHSSH',\n",
" 'SHZH',\n",
" 'SSSXZ',\n",
" 'SSSZX',\n",
" 'SSXS',\n",
" 'SSZSX',\n",
" 'SX',\n",
" 'SXHH',\n",
" 'SXSSZ',\n",
" 'SXSZS',\n",
" 'SXXX',\n",
" 'SXZSS',\n",
" 'SXZZ',\n",
" 'SZSSX',\n",
" 'SZXSS',\n",
" 'SZXZ',\n",
" 'SZZX',\n",
" 'XHHSZ',\n",
" 'XHHZS',\n",
" 'XHXHS',\n",
" 'XSHHZ',\n",
" 'XSHXH',\n",
" 'XSSS',\n",
" 'XSXXZ',\n",
" 'XSXZX',\n",
" 'XSZ',\n",
" 'XSZHH',\n",
" 'XSZXX',\n",
" 'XSZZZ',\n",
" 'XXSX',\n",
" 'XXXSZ',\n",
" 'XXXZS',\n",
" 'XXZXS',\n",
" 'XZHHS',\n",
" 'XZS',\n",
" 'XZSHH',\n",
" 'XZSXX',\n",
" 'XZSZZ',\n",
" 'XZXXS',\n",
" 'XZZSZ',\n",
" 'XZZZS',\n",
" 'ZHHXS',\n",
" 'ZHZHS',\n",
" 'ZSSSX',\n",
" 'ZSXSS',\n",
" 'ZSXZ',\n",
" 'ZSZX',\n",
" 'ZXHHS',\n",
" 'ZXS',\n",
" 'ZXSHH',\n",
" 'ZXSXX',\n",
" 'ZXSZZ',\n",
" 'ZXXXS',\n",
" 'ZXZSZ',\n",
" 'ZXZZS',\n",
" 'ZZSX',\n",
" 'ZZXSZ',\n",
" 'ZZXZS',\n",
" 'ZZZXS'},\n",
" 8: {'HHSSS',\n",
" 'HHSZ',\n",
" 'HHXSX',\n",
" 'HHZS',\n",
" 'HSHSH',\n",
" 'HXHS',\n",
" 'HZHSX',\n",
" 'SHHSS',\n",
" 'SHHZ',\n",
" 'SHXH',\n",
" 'SSHHS',\n",
" 'SSS',\n",
" 'SSSHH',\n",
" 'SSSXX',\n",
" 'SSSZZ',\n",
" 'SSXXS',\n",
" 'SSZSZ',\n",
" 'SSZZS',\n",
" 'SXSSX',\n",
" 'SXXSS',\n",
" 'SXXZ',\n",
" 'SXZX',\n",
" 'SZ',\n",
" 'SZHH',\n",
" 'SZSSZ',\n",
" 'SZSZS',\n",
" 'SZXX',\n",
" 'SZZSS',\n",
" 'SZZZ',\n",
" 'XHHSX',\n",
" 'XSHHX',\n",
" 'XSHZH',\n",
" 'XSSXS',\n",
" 'XSX',\n",
" 'XSXHH',\n",
" 'XSXXX',\n",
" 'XSXZZ',\n",
" 'XSZXZ',\n",
" 'XSZZX',\n",
" 'XXSSS',\n",
" 'XXSZ',\n",
" 'XXXSX',\n",
" 'XXZS',\n",
" 'XZSXZ',\n",
" 'XZSZX',\n",
" 'XZXS',\n",
" 'XZZSX',\n",
" 'ZHHS',\n",
" 'ZS',\n",
" 'ZSHH',\n",
" 'ZSSSZ',\n",
" 'ZSSZS',\n",
" 'ZSXX',\n",
" 'ZSZSS',\n",
" 'ZSZZ',\n",
" 'ZXSXZ',\n",
" 'ZXSZX',\n",
" 'ZXXS',\n",
" 'ZXZSX',\n",
" 'ZZSSS',\n",
" 'ZZSZ',\n",
" 'ZZXSX',\n",
" 'ZZZS'},\n",
" 18: {'HHSXZ',\n",
" 'HHSZX',\n",
" 'HHXS',\n",
" 'HHZSX',\n",
" 'HSSHS',\n",
" 'HXHSX',\n",
" 'HZHS',\n",
" 'SHHXZ',\n",
" 'SHHZX',\n",
" 'SHXHX',\n",
" 'SHXZH',\n",
" 'SHZHZ',\n",
" 'SHZXH',\n",
" 'SSSX',\n",
" 'SSXSZ',\n",
" 'SSXZS',\n",
" 'SSZXS',\n",
" 'SXHHZ',\n",
" 'SXHXH',\n",
" 'SXSS',\n",
" 'SXXXZ',\n",
" 'SXXZX',\n",
" 'SXZ',\n",
" 'SXZHH',\n",
" 'SXZXX',\n",
" 'SXZZZ',\n",
" 'SZHHX',\n",
" 'SZHZH',\n",
" 'SZSXS',\n",
" 'SZX',\n",
" 'SZXHH',\n",
" 'SZXXX',\n",
" 'SZXZZ',\n",
" 'SZZXZ',\n",
" 'SZZZX',\n",
" 'XHHS',\n",
" 'XS',\n",
" 'XSHH',\n",
" 'XSSSZ',\n",
" 'XSSZS',\n",
" 'XSXX',\n",
" 'XSZSS',\n",
" 'XSZZ',\n",
" 'XXSXZ',\n",
" 'XXSZX',\n",
" 'XXXS',\n",
" 'XXZSX',\n",
" 'XZSSS',\n",
" 'XZSZ',\n",
" 'XZXSX',\n",
" 'XZZS',\n",
" 'ZHHSX',\n",
" 'ZSHHX',\n",
" 'ZSHZH',\n",
" 'ZSSXS',\n",
" 'ZSX',\n",
" 'ZSXHH',\n",
" 'ZSXXX',\n",
" 'ZSXZZ',\n",
" 'ZSZXZ',\n",
" 'ZSZZX',\n",
" 'ZXSSS',\n",
" 'ZXSZ',\n",
" 'ZXXSX',\n",
" 'ZXZS',\n",
" 'ZZSXZ',\n",
" 'ZZSZX',\n",
" 'ZZXS',\n",
" 'ZZZSX'},\n",
" 21: {'HHSSX',\n",
" 'HHXSS',\n",
" 'HHXZ',\n",
" 'HHZX',\n",
" 'HSSHZ',\n",
" 'HSSXH',\n",
" 'HXHX',\n",
" 'HXSSH',\n",
" 'HXZH',\n",
" 'HZHSS',\n",
" 'HZHZ',\n",
" 'HZXH',\n",
" 'SHHSX',\n",
" 'SSHHX',\n",
" 'SSHZH',\n",
" 'SSSXS',\n",
" 'SSX',\n",
" 'SSXHH',\n",
" 'SSXXX',\n",
" 'SSXZZ',\n",
" 'SSZXZ',\n",
" 'SSZZX',\n",
" 'SXSSS',\n",
" 'SXSZ',\n",
" 'SXXSX',\n",
" 'SXZS',\n",
" 'SZSXZ',\n",
" 'SZSZX',\n",
" 'SZXS',\n",
" 'SZZSX',\n",
" 'XHHSS',\n",
" 'XHHZ',\n",
" 'XHXH',\n",
" 'XSHHS',\n",
" 'XSS',\n",
" 'XSSHH',\n",
" 'XSSXX',\n",
" 'XSSZZ',\n",
" 'XSXXS',\n",
" 'XSZSZ',\n",
" 'XSZZS',\n",
" 'XXSSX',\n",
" 'XXXSS',\n",
" 'XXXZ',\n",
" 'XXZX',\n",
" 'XZ',\n",
" 'XZHH',\n",
" 'XZSSZ',\n",
" 'XZSZS',\n",
" 'XZXX',\n",
" 'XZZSS',\n",
" 'XZZZ',\n",
" 'ZHHX',\n",
" 'ZHSSH',\n",
" 'ZHZH',\n",
" 'ZSSXZ',\n",
" 'ZSSZX',\n",
" 'ZSXS',\n",
" 'ZSZSX',\n",
" 'ZX',\n",
" 'ZXHH',\n",
" 'ZXSSZ',\n",
" 'ZXSZS',\n",
" 'ZXXX',\n",
" 'ZXZSS',\n",
" 'ZXZZ',\n",
" 'ZZSSX',\n",
" 'ZZXSS',\n",
" 'ZZXZ',\n",
" 'ZZZX'},\n",
" 15: {'HHSHX',\n",
" 'HHSZH',\n",
" 'HHZSH',\n",
" 'HSHS',\n",
" 'HXHSH',\n",
" 'SHHHX',\n",
" 'SHHZH',\n",
" 'SHSXS',\n",
" 'SHX',\n",
" 'SHXHH',\n",
" 'SHXXX',\n",
" 'SHXZZ',\n",
" 'SHZXZ',\n",
" 'SHZZX',\n",
" 'SSSH',\n",
" 'SXHXZ',\n",
" 'SXHZX',\n",
" 'SXXHX',\n",
" 'SXXZH',\n",
" 'SXZHZ',\n",
" 'SXZXH',\n",
" 'SZH',\n",
" 'SZHHH',\n",
" 'SZHXX',\n",
" 'SZHZZ',\n",
" 'SZXHZ',\n",
" 'SZXXH',\n",
" 'SZZHX',\n",
" 'SZZZH',\n",
" 'XSHSS',\n",
" 'XSHZ',\n",
" 'XSXH',\n",
" 'XXSHX',\n",
" 'XXSZH',\n",
" 'XXZSH',\n",
" 'XZXSH',\n",
" 'ZHHSH',\n",
" 'ZSH',\n",
" 'ZSHHH',\n",
" 'ZSHXX',\n",
" 'ZSHZZ',\n",
" 'ZSXHZ',\n",
" 'ZSXXH',\n",
" 'ZSZHX',\n",
" 'ZSZZH',\n",
" 'ZXXSH',\n",
" 'ZZSHX',\n",
" 'ZZSZH',\n",
" 'ZZZSH'},\n",
" 6: {'HHSHS',\n",
" 'HSHX',\n",
" 'HSSSH',\n",
" 'HSZH',\n",
" 'HXSHZ',\n",
" 'HXSXH',\n",
" 'HZSH',\n",
" 'SHHHS',\n",
" 'SHS',\n",
" 'SHSHH',\n",
" 'SHSXX',\n",
" 'SHSZZ',\n",
" 'SHXXS',\n",
" 'SHZSZ',\n",
" 'SHZZS',\n",
" 'SXHSZ',\n",
" 'SXHZS',\n",
" 'SXXHS',\n",
" 'SZHXS',\n",
" 'SZZHS',\n",
" 'XHSH',\n",
" 'XSHSX',\n",
" 'XXSHS',\n",
" 'ZHSHZ',\n",
" 'ZHSXH',\n",
" 'ZSHXS',\n",
" 'ZSZHS',\n",
" 'ZZSHS'},\n",
" 19: {'HSHSS',\n",
" 'HSHZ',\n",
" 'HSXH',\n",
" 'HXSHX',\n",
" 'HXSZH',\n",
" 'HXZSH',\n",
" 'HZXSH',\n",
" 'SHSXZ',\n",
" 'SHSZX',\n",
" 'SHXS',\n",
" 'SHZSX',\n",
" 'SSSHS',\n",
" 'SXHSX',\n",
" 'SZHS',\n",
" 'XHXSH',\n",
" 'XSHSZ',\n",
" 'XSHZS',\n",
" 'XSXHS',\n",
" 'XZHSH',\n",
" 'ZHSHX',\n",
" 'ZHSZH',\n",
" 'ZHZSH',\n",
" 'ZSHS',\n",
" 'ZXHSH'},\n",
" 11: {'HSHXZ',\n",
" 'HSHZX',\n",
" 'HSXHX',\n",
" 'HSXZH',\n",
" 'HSZHZ',\n",
" 'HSZXH',\n",
" 'HXSH',\n",
" 'HZSHZ',\n",
" 'HZSXH',\n",
" 'SHSSS',\n",
" 'SHSZ',\n",
" 'SHXSX',\n",
" 'SHZS',\n",
" 'SSHSH',\n",
" 'SXHS',\n",
" 'SZHSX',\n",
" 'XHSHZ',\n",
" 'XHSXH',\n",
" 'XSHXS',\n",
" 'XSZHS',\n",
" 'XZSHS',\n",
" 'ZHSH',\n",
" 'ZSHSX',\n",
" 'ZXSHS'},\n",
" 9: {'HHSHZ',\n",
" 'HHSXH',\n",
" 'HSHXS',\n",
" 'HSZHS',\n",
" 'HZSHS',\n",
" 'SHHHZ',\n",
" 'SHHXH',\n",
" 'SHSS',\n",
" 'SHXXZ',\n",
" 'SHXZX',\n",
" 'SHZ',\n",
" 'SHZHH',\n",
" 'SHZXX',\n",
" 'SHZZZ',\n",
" 'SSXSH',\n",
" 'SXH',\n",
" 'SXHHH',\n",
" 'SXHXX',\n",
" 'SXHZZ',\n",
" 'SXXHZ',\n",
" 'SXXXH',\n",
" 'SXZHX',\n",
" 'SXZZH',\n",
" 'SZHXZ',\n",
" 'SZHZX',\n",
" 'SZXHX',\n",
" 'SZXZH',\n",
" 'SZZHZ',\n",
" 'SZZXH',\n",
" 'XHSHS',\n",
" 'XSHX',\n",
" 'XSSSH',\n",
" 'XSZH',\n",
" 'XXSHZ',\n",
" 'XXSXH',\n",
" 'XZSH',\n",
" 'ZSHXZ',\n",
" 'ZSHZX',\n",
" 'ZSXHX',\n",
" 'ZSXZH',\n",
" 'ZSZHZ',\n",
" 'ZSZXH',\n",
" 'ZXSH',\n",
" 'ZZSHZ',\n",
" 'ZZSXH'},\n",
" 22: {'HHXSH',\n",
" 'HSHSZ',\n",
" 'HSHZS',\n",
" 'HSXHS',\n",
" 'HZHSH',\n",
" 'SHSSX',\n",
" 'SHXSS',\n",
" 'SHXZ',\n",
" 'SHZX',\n",
" 'SSSHZ',\n",
" 'SSSXH',\n",
" 'SXHX',\n",
" 'SXSSH',\n",
" 'SXZH',\n",
" 'SZHSS',\n",
" 'SZHZ',\n",
" 'SZXH',\n",
" 'XHHSH',\n",
" 'XSH',\n",
" 'XSHHH',\n",
" 'XSHXX',\n",
" 'XSHZZ',\n",
" 'XSXHZ',\n",
" 'XSXXH',\n",
" 'XSZHX',\n",
" 'XSZZH',\n",
" 'XXXSH',\n",
" 'XZSHX',\n",
" 'XZSZH',\n",
" 'XZZSH',\n",
" 'ZSHSS',\n",
" 'ZSHZ',\n",
" 'ZSXH',\n",
" 'ZXSHX',\n",
" 'ZXSZH',\n",
" 'ZXZSH',\n",
" 'ZZXSH'}})"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"results"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['H',\n",
" 'S',\n",
" 'ZZ',\n",
" 'SH',\n",
" 'HS',\n",
" 'Z',\n",
" 'SHS',\n",
" 'HZ',\n",
" 'ZS',\n",
" 'SXH',\n",
" 'HSZ',\n",
" 'HXSH',\n",
" 'HSH',\n",
" 'HX',\n",
" 'X',\n",
" 'ZSH',\n",
" 'SX',\n",
" 'HXS',\n",
" 'XS',\n",
" 'SZHS',\n",
" 'ZXH',\n",
" 'XZ',\n",
" 'XSH',\n",
" 'HSX']"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lookup_table = [min(v, key=lambda x:len(x)) for k,v in sorted(results.items(), key=lambda x:x[0])]\n",
"lookup_table"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}