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

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

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

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

l.v = f
l.z = i
l.p = e
e.y = f
e.o = l
e.r = b
f.t = l
f.z = l
f.r = l
i.y = b
i.o = l
i.r = f
b.t = l
b.z = l
b.r = l
assert b.z.v.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: B = None
        self.p: B = None
        self.txt = txt

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

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

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

l.v = f
l.z = i
l.p = e
e.y = f
e.o = l
e.r = b
f.t = l
f.z = l
f.r = l
i.y = b
i.o = l
i.r = f
b.t = l
b.z = l
b.r = l
assert b.z.v.r.z.txt == "i"