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

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

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

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

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

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

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

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

e.o = b
k.x = i
g.x = e
g.t = k
g.v = i
b.x = g
d.o = b
i.x = d
i.t = b
i.v = g
assert i.x.o.x.x.txt == "e"