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

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

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

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

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

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

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

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

f.z = k
f.w = i
k.w = i
k.q = i
h.s = a
h.t = b
i.w = k
i.q = k
b.z = i
b.w = k
e.z = i
e.w = i
c.z = i
c.w = i
n.z = i
n.w = k
a.s = h
a.t = n
assert b.w.q.w.q.txt == "i"