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

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

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

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

i.y = k
i.t = a
h.v = f
h.z = b
c.t = f
c.p = b
c.v = h
b.y = d
b.t = n
m.v = b
m.z = f
a.t = i
a.p = i
a.v = h
f.y = a
f.t = c
n.t = i
n.p = f
n.v = m
k.t = f
k.p = i
k.v = h
d.t = i
d.p = b
d.v = m
assert b.t.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.txt = txt

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

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

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

i.y = k
i.t = a
h.v = f
h.z = b
c.t = f
c.p = b
c.v = h
b.y = d
b.t = n
m.v = b
m.z = f
a.t = i
a.p = i
a.v = h
f.y = a
f.t = c
n.t = i
n.p = f
n.v = m
k.t = f
k.p = i
k.v = h
d.t = i
d.p = b
d.v = m
assert b.t.v.z.txt == "f"