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

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

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

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

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

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

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

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

d.t = e
g.t = e
g.z = a
g.y = n
k.w = j
k.s = d
e.t = m
h.w = g
h.s = m
a.w = n
a.s = d
j.t = i
j.z = k
j.y = g
n.t = i
n.z = h
n.y = g
i.t = e
m.t = i
assert g.z.w.y.t.t.t.txt == "i"