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

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

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

b = A("b")
c = B("c")
h = C("h")
e = C("e")

b.r = e
b.p = c
b.s = c
c.v = b
c.y = e
c.w = e
h.u = b
e.u = b
assert b.r.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: B = None
        self.s: B = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
h = C("h")
e = C("e")

b.r = e
b.p = c
b.s = c
c.v = b
c.y = e
c.w = e
h.u = b
e.u = b
assert b.r.u.p.txt == "c"