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

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

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

i = A("i")
j = B("j")
n = C("n")
k = C("k")

i.v = j
i.y = k
j.p = n
j.q = i
n.y = i
n.o = i
n.q = k
k.y = i
k.o = i
k.q = n
assert n.o.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.txt = txt

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

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

i = A("i")
j = B("j")
n = C("n")
k = C("k")

i.v = j
i.y = k
j.p = n
j.q = i
n.y = i
n.o = i
n.q = k
k.y = i
k.o = i
k.q = n
assert n.o.y.q.txt == "n"