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

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

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

i = A("i")
m = B("m")
e = C("e")

i.q = m
i.t = e
m.o = e
m.r = i
e.v = i
assert i.q.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: C = None
        self.txt = txt

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

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

i = A("i")
m = B("m")
e = C("e")

i.q = m
i.t = e
m.o = e
m.r = i
e.v = i
assert i.q.o.v.txt == "i"