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

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

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

f = A("f")
l = B("l")
n = C("n")
i = A("i")

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

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

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

f = A("f")
l = B("l")
n = C("n")
i = A("i")

f.z = i
f.v = n
f.s = n
l.y = i
n.u = l
n.p = l
i.z = f
i.v = n
i.s = n
assert f.v.u.y.txt == "i"