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

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

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

m = A("m")
d = B("d")
a = C("a")
c = A("c")
b = B("b")
j = C("j")
n = B("n")
f = A("f")

m.y = c
m.q = c
m.z = n
d.o = a
d.w = a
d.t = m
a.s = j
a.q = c
a.u = d
c.y = f
c.q = m
c.z = d
b.o = j
b.w = a
b.t = c
j.s = a
j.q = m
j.u = d
n.o = a
n.w = a
n.t = f
f.y = c
f.q = m
f.z = b
assert j.u.t.z.o.u.t.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: A = None
        self.z: B = None
        self.txt = txt

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

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

m = A("m")
d = B("d")
a = C("a")
c = A("c")
b = B("b")
j = C("j")
n = B("n")
f = A("f")

m.y = c
m.q = c
m.z = n
d.o = a
d.w = a
d.t = m
a.s = j
a.q = c
a.u = d
c.y = f
c.q = m
c.z = d
b.o = j
b.w = a
b.t = c
j.s = a
j.q = m
j.u = d
n.o = a
n.w = a
n.t = f
f.y = c
f.q = m
f.z = b
assert j.u.t.z.o.u.t.z.o.txt == "a"