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

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

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

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

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

m = A("m")
l = B("l")
f = C("f")
c = D("c")
h = E("h")
i = A("i")
k = C("k")

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

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

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

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

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

m = A("m")
l = B("l")
f = C("f")
c = D("c")
h = E("h")
i = A("i")
k = C("k")

m.x = c
m.p = l
m.s = l
m.q = f
m.y = i
l.w = f
l.r = h
l.u = i
f.y = h
f.r = k
f.u = c
f.s = c
c.r = m
c.x = l
h.w = k
h.x = c
h.q = f
i.x = c
i.p = l
i.s = l
i.q = k
i.y = m
k.y = h
k.r = f
k.u = c
k.s = c
assert l.r.w.y.w.txt == "k"