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

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

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

h = A("h")
m = B("m")
n = C("n")
j = C("j")
a = A("a")
i = A("i")
k = B("k")

h.q = j
h.z = n
m.z = j
m.v = j
m.w = k
n.q = j
n.w = j
n.v = i
j.q = n
j.w = n
j.v = a
a.q = n
a.z = j
i.q = j
i.z = n
k.z = j
k.v = j
k.w = m
assert h.q.w.v.q.q.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: C = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
n = C("n")
j = C("j")
a = A("a")
i = A("i")
k = B("k")

h.q = j
h.z = n
m.z = j
m.v = j
m.w = k
n.q = j
n.w = j
n.v = i
j.q = n
j.w = n
j.v = a
a.q = n
a.z = j
i.q = j
i.z = n
k.z = j
k.v = j
k.w = m
assert h.q.w.v.q.q.w.w.txt == "n"