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

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

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

j = A("j")
h = B("h")
n = C("n")
i = B("i")
c = A("c")
b = C("b")
m = C("m")
e = C("e")

j.z = c
h.z = c
h.v = n
h.t = i
n.y = j
i.z = j
i.v = b
i.t = h
c.z = j
b.y = c
m.y = c
e.y = c
assert b.y.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

j = A("j")
h = B("h")
n = C("n")
i = B("i")
c = A("c")
b = C("b")
m = C("m")
e = C("e")

j.z = c
h.z = c
h.v = n
h.t = i
n.y = j
i.z = j
i.v = b
i.t = h
c.z = j
b.y = c
m.y = c
e.y = c
assert b.y.z.z.z.z.txt == "c"