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

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

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

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

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

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

a.z = c
a.r = d
a.s = f
a.u = m
f.x = g
m.z = a
g.u = d
g.y = f
g.t = m
d.x = a
c.u = d
c.y = f
c.t = m
assert a.r.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: E = None
        self.s: B = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

a.z = c
a.r = d
a.s = f
a.u = m
f.x = g
m.z = a
g.u = d
g.y = f
g.t = m
d.x = a
c.u = d
c.y = f
c.t = m
assert a.r.x.z.txt == "c"