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

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

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

k = A("k")
c = B("c")
j = C("j")
h = C("h")
i = C("i")
n = A("n")
b = C("b")
f = C("f")
l = B("l")
a = C("a")

k.w = n
k.z = c
c.t = a
c.q = a
j.x = k
j.y = i
h.x = n
h.y = i
i.x = n
i.y = j
n.w = k
n.z = c
b.x = n
b.y = j
f.x = n
f.y = b
l.t = a
l.q = a
a.x = n
a.y = f
assert b.y.y.x.z.t.x.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: B = None
        self.txt = txt

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

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

k = A("k")
c = B("c")
j = C("j")
h = C("h")
i = C("i")
n = A("n")
b = C("b")
f = C("f")
l = B("l")
a = C("a")

k.w = n
k.z = c
c.t = a
c.q = a
j.x = k
j.y = i
h.x = n
h.y = i
i.x = n
i.y = j
n.w = k
n.z = c
b.x = n
b.y = j
f.x = n
f.y = b
l.t = a
l.q = a
a.x = n
a.y = f
assert b.y.y.x.z.t.x.z.q.txt == "a"