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

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

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

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

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

m = A("m")
e = B("e")
g = C("g")
k = D("k")
d = E("d")
f = C("f")

m.x = e
m.t = e
m.v = d
m.w = d
e.u = k
e.z = m
g.r = d
g.x = d
g.t = m
k.o = f
d.p = g
d.w = k
f.r = d
f.x = d
f.t = m
assert m.t.z.w.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: B = None
        self.v: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

m = A("m")
e = B("e")
g = C("g")
k = D("k")
d = E("d")
f = C("f")

m.x = e
m.t = e
m.v = d
m.w = d
e.u = k
e.z = m
g.r = d
g.x = d
g.t = m
k.o = f
d.p = g
d.w = k
f.r = d
f.x = d
f.t = m
assert m.t.z.w.p.x.txt == "d"