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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: C = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: C = None
        self.txt = txt

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

m.u = g
j.u = g
j.r = a
j.y = k
j.p = l
a.x = n
c.r = l
c.q = a
g.u = m
g.p = a
l.r = c
l.q = a
e.r = l
e.q = a
k.u = g
k.r = a
k.y = j
k.p = l
n.u = m
n.p = a
assert k.u.p.x.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: C = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: C = None
        self.txt = txt

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

m.u = g
j.u = g
j.r = a
j.y = k
j.p = l
a.x = n
c.r = l
c.q = a
g.u = m
g.p = a
l.r = c
l.q = a
e.r = l
e.q = a
k.u = g
k.r = a
k.y = j
k.p = l
n.u = m
n.p = a
assert k.u.p.x.u.u.txt == "g"