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

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

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

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

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

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

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

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

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

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

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