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

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

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

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

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

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

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

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

c.z = i
c.y = i
c.o = f
i.r = n
e.v = f
e.q = f
e.r = c
b.z = i
b.y = n
b.o = e
n.r = i
f.v = e
f.q = e
f.r = b
assert f.r.o.q.r.y.txt == "n"