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

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

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

n = A("n")
j = B("j")
l = C("l")

n.y = l
j.q = l
j.o = l
j.t = n
l.s = n
l.q = n
l.v = n
assert n.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

n = A("n")
j = B("j")
l = C("l")

n.y = l
j.q = l
j.o = l
j.t = n
l.s = n
l.q = n
l.v = n
assert n.y.v.y.txt == "l"