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

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

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

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

l = A("l")
e = B("e")
c = C("c")
b = D("b")

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

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

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

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

l = A("l")
e = B("e")
c = C("c")
b = D("b")

l.q = e
l.t = e
l.x = e
l.v = c
e.y = c
c.t = l
c.v = b
b.v = l
assert b.v.q.y.t.txt == "l"