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

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

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

f = A("f")
e = B("e")
i = C("i")
g = C("g")
b = A("b")
d = A("d")
l = B("l")

f.z = d
f.v = i
e.v = l
e.p = d
e.y = f
i.s = f
i.u = l
g.s = f
g.u = e
b.z = f
b.v = g
d.z = b
d.v = g
l.v = e
l.p = d
l.y = b
assert f.v.u.y.z.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.txt = txt

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

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

f = A("f")
e = B("e")
i = C("i")
g = C("g")
b = A("b")
d = A("d")
l = B("l")

f.z = d
f.v = i
e.v = l
e.p = d
e.y = f
i.s = f
i.u = l
g.s = f
g.u = e
b.z = f
b.v = g
d.z = b
d.v = g
l.v = e
l.p = d
l.y = b
assert f.v.u.y.z.v.u.txt == "l"