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

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

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

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

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

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

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

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

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

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

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

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

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