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

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

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

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

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

l.t = h
h.r = j
h.u = i
i.w = j
i.x = b
i.p = h
j.u = h
j.y = i
j.z = i
b.t = h
f.t = h
assert h.r.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

l.t = h
h.r = j
h.u = i
i.w = j
i.x = b
i.p = h
j.u = h
j.y = i
j.z = i
b.t = h
f.t = h
assert h.r.y.p.txt == "h"