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

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

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

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

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

i.v = c
i.z = n
a.y = c
a.z = m
a.o = i
h.t = d
h.u = i
c.s = a
c.q = d
f.y = m
f.z = m
f.o = i
n.v = c
n.z = i
d.t = l
d.u = n
l.t = h
l.u = i
k.s = f
k.q = l
m.s = a
m.q = d
assert k.s.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: A = None
        self.txt = txt

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

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

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

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

i.v = c
i.z = n
a.y = c
a.z = m
a.o = i
h.t = d
h.u = i
c.s = a
c.q = d
f.y = m
f.z = m
f.o = i
n.v = c
n.z = i
d.t = l
d.u = n
l.t = h
l.u = i
k.s = f
k.q = l
m.s = a
m.q = d
assert k.s.o.z.txt == "n"