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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.o: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.u: D = None
        self.r: C = None
        self.txt = txt

c = A("c")
a = B("a")
m = C("m")
d = D("d")
k = E("k")
h = A("h")

c.t = m
a.w = m
a.y = m
m.q = a
m.p = a
m.o = a
d.y = m
d.o = a
d.x = h
k.z = c
k.s = c
k.u = d
k.r = m
h.t = m
assert h.t.q.y.p.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.o: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.u: D = None
        self.r: C = None
        self.txt = txt

c = A("c")
a = B("a")
m = C("m")
d = D("d")
k = E("k")
h = A("h")

c.t = m
a.w = m
a.y = m
m.q = a
m.p = a
m.o = a
d.y = m
d.o = a
d.x = h
k.z = c
k.s = c
k.u = d
k.r = m
h.t = m
assert h.t.q.y.p.w.o.txt == "a"