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

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

f = A("f")
i = B("i")
e = C("e")
h = D("h")
c = C("c")

f.z = h
f.o = h
f.t = i
f.v = i
i.z = c
e.v = f
h.o = e
h.u = f
h.r = i
c.v = f
assert h.o.v.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: D = None
        self.t: B = None
        self.v: 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.v: A = None
        self.txt = txt

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

f = A("f")
i = B("i")
e = C("e")
h = D("h")
c = C("c")

f.z = h
f.o = h
f.t = i
f.v = i
i.z = c
e.v = f
h.o = e
h.u = f
h.r = i
c.v = f
assert h.o.v.t.z.txt == "c"