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

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

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

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

c = A("c")
k = B("k")
f = C("f")
l = D("l")
j = A("j")
a = C("a")
h = B("h")

c.x = k
k.z = a
f.t = a
f.z = c
f.r = k
f.y = h
l.o = a
j.x = h
a.t = f
a.z = c
a.r = k
a.y = k
h.z = f
assert c.x.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
f = C("f")
l = D("l")
j = A("j")
a = C("a")
h = B("h")

c.x = k
k.z = a
f.t = a
f.z = c
f.r = k
f.y = h
l.o = a
j.x = h
a.t = f
a.z = c
a.r = k
a.y = k
h.z = f
assert c.x.z.y.z.txt == "a"