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

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

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

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

e.v = l
l.r = n
l.z = e
a.y = i
f.v = i
i.r = n
i.z = e
n.r = l
n.z = f
c.v = l
assert f.v.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

e.v = l
l.r = n
l.z = e
a.y = i
f.v = i
i.r = n
i.z = e
n.r = l
n.z = f
c.v = l
assert f.v.r.z.txt == "f"