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

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

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

k = A("k")
b = B("b")
j = C("j")
e = A("e")
f = B("f")
m = A("m")
l = B("l")
n = B("n")

k.q = j
k.w = e
k.r = b
b.t = j
b.q = j
b.y = k
j.z = e
j.u = m
e.q = j
e.w = k
e.r = n
f.t = j
f.q = j
f.y = k
m.q = j
m.w = e
m.r = f
l.t = j
l.q = j
l.y = e
n.t = j
n.q = j
n.y = m
assert e.w.r.y.w.w.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: A = None
        self.r: B = None
        self.txt = txt

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

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

k = A("k")
b = B("b")
j = C("j")
e = A("e")
f = B("f")
m = A("m")
l = B("l")
n = B("n")

k.q = j
k.w = e
k.r = b
b.t = j
b.q = j
b.y = k
j.z = e
j.u = m
e.q = j
e.w = k
e.r = n
f.t = j
f.q = j
f.y = k
m.q = j
m.w = e
m.r = f
l.t = j
l.q = j
l.y = e
n.t = j
n.q = j
n.y = m
assert e.w.r.y.w.w.r.q.txt == "j"