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

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

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: C = None
        self.w: A = None
        self.txt = txt

l = A("l")
i = B("i")
k = C("k")
j = D("j")
n = D("n")
d = A("d")

l.x = d
i.v = k
k.x = d
k.q = d
k.s = i
k.p = i
j.z = n
j.p = k
j.w = d
n.z = j
n.p = k
n.w = l
d.x = l
assert i.v.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: C = None
        self.w: A = None
        self.txt = txt

l = A("l")
i = B("i")
k = C("k")
j = D("j")
n = D("n")
d = A("d")

l.x = d
i.v = k
k.x = d
k.q = d
k.s = i
k.p = i
j.z = n
j.p = k
j.w = d
n.z = j
n.p = k
n.w = l
d.x = l
assert i.v.x.x.txt == "l"