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

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

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

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

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

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

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

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

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

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

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

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

d.t = g
d.w = c
d.q = a
h.q = f
m.p = n
m.y = c
m.x = k
m.s = a
m.v = l
n.v = h
n.w = h
n.x = g
n.r = k
f.x = g
c.x = m
k.v = h
k.w = h
k.x = m
k.r = n
l.t = m
l.w = c
l.q = g
a.p = k
a.y = f
a.x = n
a.s = g
a.v = d
g.p = n
g.x = n
g.y = f
g.s = a
g.v = l
assert l.w.x.p.r.r.w.q.x.s.p.txt == "k"