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

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

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

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

b = A("b")
n = B("n")
e = C("e")
i = D("i")
l = B("l")
d = A("d")

b.s = i
n.z = i
e.y = d
e.r = d
e.u = b
i.p = l
i.u = n
l.z = i
d.s = i
assert n.z.u.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

b = A("b")
n = B("n")
e = C("e")
i = D("i")
l = B("l")
d = A("d")

b.s = i
n.z = i
e.y = d
e.r = d
e.u = b
i.p = l
i.u = n
l.z = i
d.s = i
assert n.z.u.z.p.txt == "l"