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

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

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

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

e.y = a
e.x = b
b.x = l
a.v = e
a.r = b
l.y = a
l.x = b
assert e.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: B = None
        self.txt = txt

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

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

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

e.y = a
e.x = b
b.x = l
a.v = e
a.r = b
l.y = a
l.x = b
assert e.x.x.x.txt == "b"