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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: B = None
        self.q: A = None
        self.t: C = None
        self.x: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: B = None
        self.q: A = None
        self.t: C = None
        self.x: A = None
        self.txt = txt

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

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

f.w = m
f.v = h
f.r = d
f.o = d
k.o = h
k.x = m
h.u = k
m.w = d
m.r = k
m.q = f
m.x = f
m.t = h
l.u = h
l.s = h
l.r = a
l.p = m
l.x = k
a.u = h
a.s = h
a.r = l
a.p = m
a.x = n
n.o = h
n.x = m
d.w = m
d.v = h
d.r = f
d.o = f
assert f.r.w.x.w.w.v.u.x.txt == "m"