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

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

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

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.q: G = None
        self.p: C = None
        self.s: E = None
        self.y: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: B = None
        self.x: B = None
        self.t: H = None
        self.v: C = None
        self.w: G = None
        self.p: E = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: G = None
        self.o: E = None
        self.w: A = None
        self.v: G = None
        self.u: H = None
        self.x: F = None
        self.r: F = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.q: G = None
        self.p: C = None
        self.s: E = None
        self.y: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: B = None
        self.x: B = None
        self.t: H = None
        self.v: C = None
        self.w: G = None
        self.p: E = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: G = None
        self.o: E = None
        self.w: A = None
        self.v: G = None
        self.u: H = None
        self.x: F = None
        self.r: F = None
        self.txt = txt

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

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