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

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

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

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

g = A("g")
f = B("f")
e = C("e")
h = D("h")

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

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

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

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

g = A("g")
f = B("f")
e = C("e")
h = D("h")

g.u = e
g.t = f
f.r = e
e.s = f
e.o = f
h.z = e
h.y = e
h.w = f
assert g.t.r.s.r.txt == "e"