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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: A = None
        self.u: A = None
        self.q: A = None
        self.txt = txt

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

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

i.q = n
i.o = n
i.z = k
j.w = l
j.s = k
j.y = n
j.v = n
n.r = k
n.o = i
n.u = i
n.q = i
k.z = i
k.v = i
k.o = i
k.y = n
l.w = j
l.s = k
l.y = n
l.v = n
assert i.z.y.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: C = None
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: A = None
        self.u: A = None
        self.q: A = None
        self.txt = txt

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

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

i.q = n
i.o = n
i.z = k
j.w = l
j.s = k
j.y = n
j.v = n
n.r = k
n.o = i
n.u = i
n.q = i
k.z = i
k.v = i
k.o = i
k.y = n
l.w = j
l.s = k
l.y = n
l.v = n
assert i.z.y.r.z.txt == "i"