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

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

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

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

f = A("f")
l = B("l")
e = C("e")
d = D("d")
m = C("m")
h = D("h")
a = C("a")
g = D("g")
j = C("j")

f.x = e
l.s = j
e.z = f
e.u = a
d.o = f
m.z = f
m.u = e
h.o = f
a.z = f
a.u = j
g.o = f
j.z = f
j.u = a
assert m.z.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
e = C("e")
d = D("d")
m = C("m")
h = D("h")
a = C("a")
g = D("g")
j = C("j")

f.x = e
l.s = j
e.z = f
e.u = a
d.o = f
m.z = f
m.u = e
h.o = f
a.z = f
a.u = j
g.o = f
j.z = f
j.u = a
assert m.z.x.z.x.txt == "e"