class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: G = None
        self.z: F = None
        self.p: D = None
        self.w: B = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: D = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.p: A = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: E = None
        self.txt = txt

n = A("n")
h = B("h")
i = C("i")
l = D("l")
k = E("k")
f = F("f")
a = G("a")
m = G("m")

n.x = f
n.z = f
n.v = m
n.p = l
n.w = h
n.s = i
h.y = f
i.z = n
i.s = l
i.t = m
l.y = n
l.o = n
l.p = n
l.t = h
k.o = l
f.w = l
a.u = n
a.s = k
m.u = n
m.s = k
assert f.w.t.y.w.t.y.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: G = None
        self.z: F = None
        self.p: D = None
        self.w: B = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: D = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.p: A = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: E = None
        self.txt = txt

n = A("n")
h = B("h")
i = C("i")
l = D("l")
k = E("k")
f = F("f")
a = G("a")
m = G("m")

n.x = f
n.z = f
n.v = m
n.p = l
n.w = h
n.s = i
h.y = f
i.z = n
i.s = l
i.t = m
l.y = n
l.o = n
l.p = n
l.t = h
k.o = l
f.w = l
a.u = n
a.s = k
m.u = n
m.s = k
assert f.w.t.y.w.t.y.w.t.txt == "h"