class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: E = None
        self.x: H = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: A = None
        self.t: H = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

a = A("a")
n = B("n")
e = C("e")
k = D("k")
m = E("m")
i = F("i")
c = G("c")
d = H("d")

a.q = m
a.u = m
a.x = d
a.w = c
n.t = e
n.w = a
n.r = k
n.y = k
n.x = c
e.y = n
e.t = d
e.u = c
k.w = m
m.s = a
m.o = d
m.w = n
m.v = e
i.o = m
i.p = n
c.r = n
c.q = a
c.t = d
c.o = e
d.r = n
assert d.r.x.r.y.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: E = None
        self.x: H = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: A = None
        self.t: H = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

a = A("a")
n = B("n")
e = C("e")
k = D("k")
m = E("m")
i = F("i")
c = G("c")
d = H("d")

a.q = m
a.u = m
a.x = d
a.w = c
n.t = e
n.w = a
n.r = k
n.y = k
n.x = c
e.y = n
e.t = d
e.u = c
k.w = m
m.s = a
m.o = d
m.w = n
m.v = e
i.o = m
i.p = n
c.r = n
c.q = a
c.t = d
c.o = e
d.r = n
assert d.r.x.r.y.w.v.txt == "e"