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

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

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

l = A("l")
m = B("m")
h = C("h")
j = A("j")
d = C("d")
g = C("g")
i = C("i")
k = A("k")
a = A("a")

l.t = d
l.w = g
l.q = i
m.q = j
m.z = i
h.v = i
h.y = a
h.z = j
j.t = i
j.w = i
j.q = h
d.v = h
d.y = k
d.z = j
g.v = h
g.y = a
g.z = j
i.v = g
i.y = a
i.z = k
k.t = d
k.w = d
k.q = g
a.t = i
a.w = d
a.q = h
assert a.w.y.w.z.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.q: C = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
h = C("h")
j = A("j")
d = C("d")
g = C("g")
i = C("i")
k = A("k")
a = A("a")

l.t = d
l.w = g
l.q = i
m.q = j
m.z = i
h.v = i
h.y = a
h.z = j
j.t = i
j.w = i
j.q = h
d.v = h
d.y = k
d.z = j
g.v = h
g.y = a
g.z = j
i.v = g
i.y = a
i.z = k
k.t = d
k.w = d
k.q = g
a.t = i
a.w = d
a.q = h
assert a.w.y.w.z.q.z.q.txt == "h"