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

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

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

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

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

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

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

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

j.u = i
j.v = i
j.q = e
i.y = j
e.p = j
assert j.u.y.q.txt == "e"