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

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

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

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

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

d.s = b
d.x = i
c.x = n
c.t = d
h.p = e
h.s = i
h.w = l
l.s = e
l.u = d
i.s = c
i.x = d
e.s = l
e.u = i
n.p = e
n.w = e
n.s = d
b.x = h
b.t = i
assert e.s.u.x.x.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

d.s = b
d.x = i
c.x = n
c.t = d
h.p = e
h.s = i
h.w = l
l.s = e
l.u = d
i.s = c
i.x = d
e.s = l
e.u = i
n.p = e
n.w = e
n.s = d
b.x = h
b.t = i
assert e.s.u.x.x.s.t.txt == "i"