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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: D = None
        self.txt = txt

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

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

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

f.z = l
f.u = e
f.t = e
e.x = l
e.y = i
l.o = f
i.x = l
i.y = l
i.w = l
i.o = e
h.x = l
h.y = i
assert i.w.o.z.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: B = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: D = None
        self.txt = txt

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

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

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

f.z = l
f.u = e
f.t = e
e.x = l
e.y = i
l.o = f
i.x = l
i.y = l
i.w = l
i.o = e
h.x = l
h.y = i
assert i.w.o.z.o.u.txt == "e"