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

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

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

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

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

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

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

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

e.y = b
e.t = n
n.y = i
i.u = n
i.x = e
i.o = b
b.y = g
g.u = b
g.o = b
g.x = e
assert b.y.x.t.y.u.txt == "n"