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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: A = None
        self.o: C = None
        self.w: B = None
        self.s: A = None
        self.txt = txt

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

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

l.p = a
f.u = g
f.y = j
f.w = m
f.z = a
f.r = a
m.y = a
m.p = f
h.u = m
h.o = m
h.v = l
h.s = l
h.w = f
g.v = c
a.v = c
j.u = a
j.y = f
j.w = m
j.z = g
j.r = g
c.u = m
c.o = m
c.v = l
c.s = l
c.w = f
assert h.w.z.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: A = None
        self.o: C = None
        self.w: B = None
        self.s: A = None
        self.txt = txt

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

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

l.p = a
f.u = g
f.y = j
f.w = m
f.z = a
f.r = a
m.y = a
m.p = f
h.u = m
h.o = m
h.v = l
h.s = l
h.w = f
g.v = c
a.v = c
j.u = a
j.y = f
j.w = m
j.z = g
j.r = g
c.u = m
c.o = m
c.v = l
c.s = l
c.w = f
assert h.w.z.v.u.txt == "m"