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

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

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

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

l = A("l")
k = B("k")
m = C("m")
i = D("i")

l.u = k
l.s = k
l.t = i
l.x = m
k.t = i
m.t = l
m.u = l
i.v = m
i.x = l
assert k.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: D = None
        self.x: C = None
        self.s: B = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
m = C("m")
i = D("i")

l.u = k
l.s = k
l.t = i
l.x = m
k.t = i
m.t = l
m.u = l
i.v = m
i.x = l
assert k.t.v.t.txt == "l"