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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: B = None
        self.y: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: B = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: G = None
        self.r: H = None
        self.y: F = None
        self.u: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: F = None
        self.q: A = None
        self.v: C = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: C = None
        self.txt = txt

h = A("h")
b = B("b")
m = C("m")
j = D("j")
g = E("g")
i = F("i")
f = G("f")
e = H("e")
a = A("a")

h.z = g
b.p = g
m.q = g
m.z = b
m.y = h
j.p = i
j.z = b
j.t = b
g.z = i
g.y = i
g.w = f
g.r = e
g.u = b
i.p = e
i.q = b
i.r = g
f.w = b
f.z = i
f.q = h
f.v = m
f.o = g
e.r = f
e.z = m
a.z = g
assert a.z.r.r.z.r.u.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: B = None
        self.y: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: B = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: G = None
        self.r: H = None
        self.y: F = None
        self.u: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: F = None
        self.q: A = None
        self.v: C = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: C = None
        self.txt = txt

h = A("h")
b = B("b")
m = C("m")
j = D("j")
g = E("g")
i = F("i")
f = G("f")
e = H("e")
a = A("a")

h.z = g
b.p = g
m.q = g
m.z = b
m.y = h
j.p = i
j.z = b
j.t = b
g.z = i
g.y = i
g.w = f
g.r = e
g.u = b
i.p = e
i.q = b
i.r = g
f.w = b
f.z = i
f.q = h
f.v = m
f.o = g
e.r = f
e.z = m
a.z = g
assert a.z.r.r.z.r.u.p.r.txt == "e"