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

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

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

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

b.q = a
b.z = f
f.z = a
f.q = n
f.r = k
a.v = k
a.y = k
a.p = i
i.q = a
i.z = j
j.z = a
j.q = n
j.r = n
k.v = a
k.y = a
k.p = i
h.z = a
h.q = a
h.r = k
n.v = k
n.y = k
n.p = i
assert n.p.z.z.y.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.txt = txt

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

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

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

b.q = a
b.z = f
f.z = a
f.q = n
f.r = k
a.v = k
a.y = k
a.p = i
i.q = a
i.z = j
j.z = a
j.q = n
j.r = n
k.v = a
k.y = a
k.p = i
h.z = a
h.q = a
h.r = k
n.v = k
n.y = k
n.p = i
assert n.p.z.z.y.y.v.txt == "k"