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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: A = None
        self.p: E = None
        self.s: C = None
        self.txt = txt

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

d = A("d")
m = B("m")
b = C("b")
g = D("g")
c = E("c")

d.t = c
m.z = g
b.p = g
b.q = d
g.x = m
g.u = d
g.p = c
g.s = b
c.o = g
assert m.z.p.o.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: A = None
        self.p: E = None
        self.s: C = None
        self.txt = txt

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

d = A("d")
m = B("m")
b = C("b")
g = D("g")
c = E("c")

d.t = c
m.z = g
b.p = g
b.q = d
g.x = m
g.u = d
g.p = c
g.s = b
c.o = g
assert m.z.p.o.u.t.txt == "c"