class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: C = None
        self.r: D = None
        self.y: B = None
        self.o: H = None
        self.x: E = None
        self.s: G = None
        self.v: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: G = None
        self.r: E = None
        self.t: E = None
        self.o: E = None
        self.q: H = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: H = None
        self.y: G = None
        self.u: F = None
        self.r: F = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: F = None
        self.x: D = None
        self.txt = txt

h = A("h")
l = B("l")
i = C("i")
f = D("f")
c = E("c")
d = F("d")
e = G("e")
m = H("m")

h.t = l
h.y = l
h.u = i
h.r = f
h.o = m
h.v = m
h.x = c
h.s = e
l.v = d
i.y = e
i.w = e
i.r = c
i.t = c
i.o = c
i.q = m
i.z = l
f.t = m
f.y = e
f.u = d
f.r = d
f.w = l
c.q = i
d.x = f
e.r = f
e.t = m
m.q = d
m.r = d
m.x = f
assert d.x.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: C = None
        self.r: D = None
        self.y: B = None
        self.o: H = None
        self.x: E = None
        self.s: G = None
        self.v: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: G = None
        self.r: E = None
        self.t: E = None
        self.o: E = None
        self.q: H = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: H = None
        self.y: G = None
        self.u: F = None
        self.r: F = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: F = None
        self.x: D = None
        self.txt = txt

h = A("h")
l = B("l")
i = C("i")
f = D("f")
c = E("c")
d = F("d")
e = G("e")
m = H("m")

h.t = l
h.y = l
h.u = i
h.r = f
h.o = m
h.v = m
h.x = c
h.s = e
l.v = d
i.y = e
i.w = e
i.r = c
i.t = c
i.o = c
i.q = m
i.z = l
f.t = m
f.y = e
f.u = d
f.r = d
f.w = l
c.q = i
d.x = f
e.r = f
e.t = m
m.q = d
m.r = d
m.x = f
assert d.x.t.x.t.txt == "m"