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

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

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

c = A("c")
j = B("j")
e = C("e")
a = A("a")
m = B("m")

c.o = e
c.v = e
c.x = e
j.s = a
j.o = c
e.r = a
a.o = e
a.v = e
a.x = e
m.s = c
m.o = c
assert c.o.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: C = None
        self.x: C = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
e = C("e")
a = A("a")
m = B("m")

c.o = e
c.v = e
c.x = e
j.s = a
j.o = c
e.r = a
a.o = e
a.v = e
a.x = e
m.s = c
m.o = c
assert c.o.r.v.txt == "e"