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

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

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

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

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

i.u = d
i.z = n
i.t = h
i.s = c
a.y = b
l.y = d
l.z = d
m.s = c
m.y = l
m.r = e
e.y = d
e.z = d
d.y = l
d.z = e
n.y = b
c.s = m
c.y = d
c.r = l
b.y = a
h.u = e
h.z = b
h.t = i
h.s = c
assert h.s.s.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: B = None
        self.t: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

i.u = d
i.z = n
i.t = h
i.s = c
a.y = b
l.y = d
l.z = d
m.s = c
m.y = l
m.r = e
e.y = d
e.z = d
d.y = l
d.z = e
n.y = b
c.s = m
c.y = d
c.r = l
b.y = a
h.u = e
h.z = b
h.t = i
h.s = c
assert h.s.s.s.y.txt == "d"