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

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

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

k = A("k")
d = B("d")
f = C("f")
j = A("j")
g = B("g")
l = B("l")
a = C("a")
i = B("i")
h = A("h")
b = A("b")

k.z = f
k.v = j
d.z = a
f.v = i
f.p = a
j.z = a
j.v = b
g.z = a
l.z = a
a.v = i
a.p = f
i.z = a
h.z = a
h.v = b
b.z = f
b.v = k
assert j.v.v.z.p.v.z.v.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: A = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
f = C("f")
j = A("j")
g = B("g")
l = B("l")
a = C("a")
i = B("i")
h = A("h")
b = A("b")

k.z = f
k.v = j
d.z = a
f.v = i
f.p = a
j.z = a
j.v = b
g.z = a
l.z = a
a.v = i
a.p = f
i.z = a
h.z = a
h.v = b
b.z = f
b.v = k
assert j.v.v.z.p.v.z.v.z.v.txt == "i"