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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: A = None
        self.q: D = None
        self.x: E = None
        self.txt = txt

d = A("d")
l = B("l")
h = C("h")
j = D("j")
k = E("k")
e = B("e")
m = E("m")
n = A("n")

d.w = k
d.p = n
l.u = n
h.p = j
h.u = j
h.o = k
j.v = h
j.r = l
k.o = h
k.y = d
k.q = j
k.x = m
e.u = n
m.o = h
m.y = d
m.q = j
m.x = k
n.w = k
n.p = d
assert k.x.q.v.u.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: A = None
        self.q: D = None
        self.x: E = None
        self.txt = txt

d = A("d")
l = B("l")
h = C("h")
j = D("j")
k = E("k")
e = B("e")
m = E("m")
n = A("n")

d.w = k
d.p = n
l.u = n
h.p = j
h.u = j
h.o = k
j.v = h
j.r = l
k.o = h
k.y = d
k.q = j
k.x = m
e.u = n
m.o = h
m.y = d
m.q = j
m.x = k
n.w = k
n.p = d
assert k.x.q.v.u.v.o.txt == "k"