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

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

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

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

b = A("b")
c = B("c")
h = C("h")
i = D("i")

b.z = c
b.r = c
b.s = h
c.s = i
h.u = c
i.t = h
assert i.t.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.s: C = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
h = C("h")
i = D("i")

b.z = c
b.r = c
b.s = h
c.s = i
h.u = c
i.t = h
assert i.t.u.s.txt == "i"