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

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

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

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

b.o = n
b.z = n
b.q = j
j.u = b
j.v = b
n.u = j
n.s = b
assert j.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: B = None
        self.z: C = None
        self.txt = txt

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

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

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

b.o = n
b.z = n
b.q = j
j.u = b
j.v = b
n.u = j
n.s = b
assert j.u.q.u.txt == "b"