class A:
    def __init__(self, txt: str):
        self.z: D = 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.o: D = None
        self.txt = txt

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

c = A("c")
f = B("f")
b = C("b")
k = D("k")
n = A("n")
a = D("a")

c.z = a
f.z = b
b.o = k
k.t = a
n.z = a
a.t = k
assert f.z.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = 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.o: D = None
        self.txt = txt

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

c = A("c")
f = B("f")
b = C("b")
k = D("k")
n = A("n")
a = D("a")

c.z = a
f.z = b
b.o = k
k.t = a
n.z = a
a.t = k
assert f.z.o.t.txt == "a"