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

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

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

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

d = A("d")
j = B("j")
m = C("m")
l = D("l")
e = A("e")
h = A("h")
n = D("n")

d.y = m
j.u = m
m.t = l
m.w = l
m.z = e
l.p = h
l.s = n
e.y = m
h.y = m
n.p = d
n.s = l
assert h.y.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

d = A("d")
j = B("j")
m = C("m")
l = D("l")
e = A("e")
h = A("h")
n = D("n")

d.y = m
j.u = m
m.t = l
m.w = l
m.z = e
l.p = h
l.s = n
e.y = m
h.y = m
n.p = d
n.s = l
assert h.y.z.y.z.txt == "e"