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

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

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

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

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

l = A("l")
b = B("b")
h = C("h")
d = D("d")
c = E("c")
g = B("g")
n = E("n")

l.s = d
l.q = d
l.r = b
l.w = h
b.q = c
b.r = l
b.s = h
h.u = d
d.z = g
d.p = c
d.w = h
c.o = d
c.v = d
c.w = l
c.r = h
c.u = b
g.q = n
g.r = l
g.s = h
n.o = d
n.v = d
n.w = l
n.r = h
n.u = b
assert l.r.r.s.z.r.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: B = None
        self.q: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

l = A("l")
b = B("b")
h = C("h")
d = D("d")
c = E("c")
g = B("g")
n = E("n")

l.s = d
l.q = d
l.r = b
l.w = h
b.q = c
b.r = l
b.s = h
h.u = d
d.z = g
d.p = c
d.w = h
c.o = d
c.v = d
c.w = l
c.r = h
c.u = b
g.q = n
g.r = l
g.s = h
n.o = d
n.v = d
n.w = l
n.r = h
n.u = b
assert l.r.r.s.z.r.s.w.txt == "h"