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

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

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

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

b.p = i
b.y = i
i.r = n
i.v = j
i.t = j
j.p = n
n.p = i
n.y = i
assert n.p.r.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: B = None
        self.txt = txt

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

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

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

b.p = i
b.y = i
i.r = n
i.v = j
i.t = j
j.p = n
n.p = i
n.y = i
assert n.p.r.p.v.txt == "j"