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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: A = None
        self.q: A = None
        self.r: C = None
        self.txt = txt

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

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

n = A("n")
i = B("i")
j = C("j")
b = D("b")
l = A("l")
a = B("a")
m = C("m")
d = B("d")

n.y = a
n.x = m
n.s = b
i.y = b
i.w = n
i.q = l
i.r = m
j.o = b
b.y = l
b.z = j
b.o = d
l.y = d
l.x = m
l.s = b
a.y = b
a.w = n
a.q = l
a.r = j
m.o = b
d.y = b
d.w = n
d.q = l
d.r = m
assert i.y.y.x.o.y.s.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: C = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: A = None
        self.q: A = None
        self.r: C = None
        self.txt = txt

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

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

n = A("n")
i = B("i")
j = C("j")
b = D("b")
l = A("l")
a = B("a")
m = C("m")
d = B("d")

n.y = a
n.x = m
n.s = b
i.y = b
i.w = n
i.q = l
i.r = m
j.o = b
b.y = l
b.z = j
b.o = d
l.y = d
l.x = m
l.s = b
a.y = b
a.w = n
a.q = l
a.r = j
m.o = b
d.y = b
d.w = n
d.q = l
d.r = m
assert i.y.y.x.o.y.s.z.o.txt == "b"