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

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

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

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

b.p = i
b.s = i
b.v = i
i.t = n
i.s = n
n.q = b
n.w = i
n.x = i
assert i.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: B = None
        self.v: B = None
        self.txt = txt

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

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

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

b.p = i
b.s = i
b.v = i
i.t = n
i.s = n
n.q = b
n.w = i
n.x = i
assert i.s.w.s.txt == "n"