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

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

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

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

k.y = a
k.t = h
h.q = j
h.r = g
j.u = e
g.y = h
g.t = h
n.y = h
n.t = h
e.q = j
e.r = m
a.q = j
a.r = k
m.y = h
m.t = h
l.y = h
l.t = e
assert m.t.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.txt = txt

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

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

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

k.y = a
k.t = h
h.q = j
h.r = g
j.u = e
g.y = h
g.t = h
n.y = h
n.t = h
e.q = j
e.r = m
a.q = j
a.r = k
m.y = h
m.t = h
l.y = h
l.t = e
assert m.t.q.u.q.txt == "j"