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

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

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

e = A("e")
n = B("n")
b = C("b")
l = B("l")

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

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

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

e = A("e")
n = B("n")
b = C("b")
l = B("l")

e.u = l
n.y = l
n.x = b
n.w = e
b.w = l
b.t = n
l.y = n
l.x = b
l.w = e
assert l.x.t.x.txt == "b"