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

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

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

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

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

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

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

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

h.v = e
h.w = e
h.o = e
b.r = e
b.p = j
e.s = b
e.w = h
e.t = j
j.v = e
j.w = e
j.o = e
assert e.w.o.t.w.txt == "e"