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

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

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

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

j.t = i
j.y = f
a.x = f
a.q = c
a.z = c
n.z = i
n.p = a
n.s = c
c.x = l
c.q = a
c.z = a
k.t = j
k.y = m
m.z = k
m.p = c
m.s = a
d.t = i
d.y = f
l.z = j
l.p = c
l.s = a
i.t = j
i.y = l
f.z = i
f.p = a
f.s = a
assert j.t.t.t.t.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: C = None
        self.txt = txt

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

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

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

j.t = i
j.y = f
a.x = f
a.q = c
a.z = c
n.z = i
n.p = a
n.s = c
c.x = l
c.q = a
c.z = a
k.t = j
k.y = m
m.z = k
m.p = c
m.s = a
d.t = i
d.y = f
l.z = j
l.p = c
l.s = a
i.t = j
i.y = l
f.z = i
f.p = a
f.s = a
assert j.t.t.t.t.t.y.txt == "l"