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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: A = None
        self.p: E = None
        self.r: E = None
        self.txt = txt

a = A("a")
f = B("f")
g = C("g")
c = D("c")
m = E("m")
h = C("h")
n = B("n")
e = E("e")
l = D("l")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: A = None
        self.p: E = None
        self.r: E = None
        self.txt = txt

a = A("a")
f = B("f")
g = C("g")
c = D("c")
m = E("m")
h = C("h")
n = B("n")
e = E("e")
l = D("l")

a.y = m
a.r = f
a.u = f
a.w = e
f.y = h
f.x = n
g.w = h
g.r = h
g.y = f
g.p = a
c.q = l
c.y = a
c.x = e
c.p = h
m.s = e
m.p = e
m.r = e
m.u = a
h.w = g
h.r = g
h.y = n
h.p = a
n.y = h
n.x = f
e.s = m
e.p = m
e.r = m
e.u = a
l.q = c
l.y = a
l.x = m
l.p = h
assert a.w.r.u.y.u.txt == "a"