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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

n = A("n")
j = B("j")
d = C("d")
g = D("g")
l = E("l")
b = D("b")
i = D("i")

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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

n = A("n")
j = B("j")
d = C("d")
g = D("g")
l = E("l")
b = D("b")
i = D("i")

n.y = l
n.p = j
n.x = d
j.r = l
j.w = n
d.p = j
d.o = n
d.s = n
g.y = n
g.z = j
g.p = b
g.o = i
g.w = i
l.z = g
b.y = n
b.z = j
b.p = i
b.o = i
b.w = i
i.y = n
i.z = j
i.p = g
i.w = g
i.o = b
assert d.p.w.y.txt == "l"