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

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

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

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

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

k = A("k")
h = B("h")
l = C("l")
n = D("n")
m = E("m")
b = A("b")
i = E("i")
d = D("d")
g = C("g")

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

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

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

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

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

k = A("k")
h = B("h")
l = C("l")
n = D("n")
m = E("m")
b = A("b")
i = E("i")
d = D("d")
g = C("g")

k.w = h
k.v = h
k.r = d
h.t = k
h.u = d
l.r = b
l.z = d
l.s = i
l.p = g
l.q = g
n.s = i
n.w = m
m.s = b
b.w = h
b.v = h
b.r = d
i.s = k
d.s = m
d.w = i
g.r = k
g.z = n
g.s = i
g.p = l
g.q = l
assert d.w.s.w.u.s.s.txt == "b"