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

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

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

b = A("b")
a = B("a")
h = C("h")

b.w = h
b.r = h
a.r = h
a.t = h
a.o = h
h.v = b
assert h.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: C = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
h = C("h")

b.w = h
b.r = h
a.r = h
a.t = h
a.o = h
h.v = b
assert h.v.w.v.txt == "b"