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

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

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

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

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

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

g.w = a
g.x = c
g.r = c
g.y = k
i.r = n
i.y = n
i.w = n
i.q = c
h.x = g
e.t = k
e.y = k
e.x = c
e.z = c
e.w = h
n.r = a
a.t = k
a.y = i
a.x = h
a.w = h
a.z = c
l.w = e
l.x = h
l.y = i
l.r = c
k.r = n
k.y = n
k.w = n
k.q = c
c.x = g
assert n.r.w.x.y.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: C = None
        self.y: B = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

g.w = a
g.x = c
g.r = c
g.y = k
i.r = n
i.y = n
i.w = n
i.q = c
h.x = g
e.t = k
e.y = k
e.x = c
e.z = c
e.w = h
n.r = a
a.t = k
a.y = i
a.x = h
a.w = h
a.z = c
l.w = e
l.x = h
l.y = i
l.r = c
k.r = n
k.y = n
k.w = n
k.q = c
c.x = g
assert n.r.w.x.y.r.r.txt == "a"