class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: C = None
        self.q: C = None
        self.u: E = None
        self.s: D = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: B = None
        self.v: D = None
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: D = None
        self.r: C = None
        self.u: F = None
        self.y: E = None
        self.txt = txt

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

h = A("h")
f = B("f")
n = C("n")
c = D("c")
m = E("m")
a = F("a")
e = E("e")

h.z = m
f.z = e
f.t = n
f.q = n
f.u = m
f.s = c
f.y = a
n.z = a
n.y = f
n.v = c
n.t = c
c.p = h
c.t = m
m.v = e
m.y = e
m.s = c
m.r = n
m.u = a
a.y = h
e.v = m
e.y = m
e.s = c
e.r = n
e.u = a
assert c.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: C = None
        self.q: C = None
        self.u: E = None
        self.s: D = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: B = None
        self.v: D = None
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: D = None
        self.r: C = None
        self.u: F = None
        self.y: E = None
        self.txt = txt

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

h = A("h")
f = B("f")
n = C("n")
c = D("c")
m = E("m")
a = F("a")
e = E("e")

h.z = m
f.z = e
f.t = n
f.q = n
f.u = m
f.s = c
f.y = a
n.z = a
n.y = f
n.v = c
n.t = c
c.p = h
c.t = m
m.v = e
m.y = e
m.s = c
m.r = n
m.u = a
a.y = h
e.v = m
e.y = m
e.s = c
e.r = n
e.u = a
assert c.t.s.t.txt == "m"