class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.txt = txt

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

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

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

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

f = A("f")
h = B("h")
n = C("n")
k = D("k")
l = E("l")
m = C("m")

f.y = m
f.w = k
h.w = l
h.p = k
n.o = l
n.q = l
n.t = f
n.u = h
k.u = h
k.y = h
k.r = f
k.v = f
k.p = l
l.w = f
m.o = l
m.q = l
m.t = f
m.u = h
assert n.o.w.y.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.txt = txt

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

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

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

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

f = A("f")
h = B("h")
n = C("n")
k = D("k")
l = E("l")
m = C("m")

f.y = m
f.w = k
h.w = l
h.p = k
n.o = l
n.q = l
n.t = f
n.u = h
k.u = h
k.y = h
k.r = f
k.v = f
k.p = l
l.w = f
m.o = l
m.q = l
m.t = f
m.u = h
assert n.o.w.y.u.w.txt == "l"