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

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

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

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

n.p = i
n.u = b
n.y = m
i.s = b
b.u = i
b.r = n
m.u = i
m.r = n
assert n.u.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: C = None
        self.y: C = None
        self.txt = txt

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

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

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

n.p = i
n.u = b
n.y = m
i.s = b
b.u = i
b.r = n
m.u = i
m.r = n
assert n.u.u.s.txt == "b"