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

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

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

j = A("j")
m = B("m")
e = C("e")
l = B("l")

j.u = l
m.t = j
m.x = e
e.v = j
e.y = l
l.t = j
l.x = e
assert j.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

j = A("j")
m = B("m")
e = C("e")
l = B("l")

j.u = l
m.t = j
m.x = e
e.v = j
e.y = l
l.t = j
l.x = e
assert j.u.t.u.t.txt == "j"