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

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

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

a = A("a")
h = B("h")
b = C("b")
e = A("e")
f = C("f")
l = B("l")
i = B("i")
c = A("c")

a.z = h
a.y = f
a.s = f
h.v = e
h.q = c
h.z = a
b.z = c
b.w = f
b.s = a
e.z = l
e.y = f
e.s = b
f.z = c
f.w = b
f.s = e
l.v = a
l.q = e
l.z = e
i.v = a
i.z = a
i.q = c
c.z = i
c.y = f
c.s = f
assert a.z.v.z.v.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: C = None
        self.s: C = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
b = C("b")
e = A("e")
f = C("f")
l = B("l")
i = B("i")
c = A("c")

a.z = h
a.y = f
a.s = f
h.v = e
h.q = c
h.z = a
b.z = c
b.w = f
b.s = a
e.z = l
e.y = f
e.s = b
f.z = c
f.w = b
f.s = e
l.v = a
l.q = e
l.z = e
i.v = a
i.z = a
i.q = c
c.z = i
c.y = f
c.s = f
assert a.z.v.z.v.y.z.y.txt == "f"