class A:
    def __init__(self, txt: str):
        self.x: C = 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.t: B = None
        self.txt = txt

e = A("e")
l = B("l")
d = C("d")

e.x = d
l.x = e
d.t = l
assert d.t.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = 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.t: B = None
        self.txt = txt

e = A("e")
l = B("l")
d = C("d")

e.x = d
l.x = e
d.t = l
assert d.t.x.x.txt == "d"