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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: E = None
        self.u: D = None
        self.y: E = None
        self.w: B = None
        self.txt = txt

c = A("c")
m = B("m")
l = C("l")
a = D("a")
b = E("b")
f = E("f")
n = B("n")
h = B("h")
i = D("i")
d = A("d")

c.w = d
c.s = d
c.q = n
c.p = l
c.o = b
m.y = h
m.x = d
m.q = l
l.q = a
a.x = n
a.r = i
b.r = l
b.x = f
b.y = f
b.u = i
b.w = h
f.r = l
f.x = b
f.y = b
f.u = a
f.w = n
n.y = m
n.x = d
n.q = l
h.y = m
h.x = d
h.q = l
i.x = m
i.r = a
d.w = c
d.s = c
d.q = h
d.p = l
d.o = b
assert m.y.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: A = None
        self.q: B = None
        self.p: C = None
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: E = None
        self.u: D = None
        self.y: E = None
        self.w: B = None
        self.txt = txt

c = A("c")
m = B("m")
l = C("l")
a = D("a")
b = E("b")
f = E("f")
n = B("n")
h = B("h")
i = D("i")
d = A("d")

c.w = d
c.s = d
c.q = n
c.p = l
c.o = b
m.y = h
m.x = d
m.q = l
l.q = a
a.x = n
a.r = i
b.r = l
b.x = f
b.y = f
b.u = i
b.w = h
f.r = l
f.x = b
f.y = b
f.u = a
f.w = n
n.y = m
n.x = d
n.q = l
h.y = m
h.x = d
h.q = l
i.x = m
i.r = a
d.w = c
d.s = c
d.q = h
d.p = l
d.o = b
assert m.y.x.s.txt == "c"