class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: F = None
        self.w: F = None
        self.v: C = None
        self.q: 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: A = None
        self.w: G = None
        self.r: E = None
        self.z: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: G = None
        self.x: B = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.v: F = None
        self.x: B = None
        self.txt = txt

h = A("h")
a = B("a")
m = C("m")
e = D("e")
j = E("j")
g = F("g")
d = G("d")
k = H("k")

h.o = a
h.u = g
h.w = g
h.v = m
h.q = e
a.w = j
a.p = e
m.o = h
m.w = d
m.r = j
m.z = j
e.w = j
e.o = m
j.u = a
j.x = a
j.v = d
j.z = d
g.v = m
g.u = k
d.x = k
k.p = d
k.v = g
k.x = a
assert e.o.o.o.w.z.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: F = None
        self.w: F = None
        self.v: C = None
        self.q: 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: A = None
        self.w: G = None
        self.r: E = None
        self.z: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: G = None
        self.x: B = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.v: F = None
        self.x: B = None
        self.txt = txt

h = A("h")
a = B("a")
m = C("m")
e = D("e")
j = E("j")
g = F("g")
d = G("d")
k = H("k")

h.o = a
h.u = g
h.w = g
h.v = m
h.q = e
a.w = j
a.p = e
m.o = h
m.w = d
m.r = j
m.z = j
e.w = j
e.o = m
j.u = a
j.x = a
j.v = d
j.z = d
g.v = m
g.u = k
d.x = k
k.p = d
k.v = g
k.x = a
assert e.o.o.o.w.z.x.p.txt == "d"