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

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

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

b = A("b")
i = B("i")
e = C("e")
g = A("g")

b.v = e
b.t = e
b.s = g
i.v = b
i.x = b
i.p = g
e.o = i
g.v = e
g.t = e
g.s = b
assert e.o.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: C = None
        self.s: A = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
e = C("e")
g = A("g")

b.v = e
b.t = e
b.s = g
i.v = b
i.x = b
i.p = g
e.o = i
g.v = e
g.t = e
g.s = b
assert e.o.p.v.txt == "e"