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

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.t: A = None
        self.w: A = None
        self.s: E = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.u: E = None
        self.t: E = None
        self.s: D = None
        self.r: F = None
        self.o: E = None
        self.w: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: H = None
        self.x: G = None
        self.r: B = None
        self.v: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: D = None
        self.z: B = None
        self.y: B = None
        self.w: E = None
        self.t: A = None
        self.v: H = None
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.z: A = None
        self.s: E = None
        self.u: E = None
        self.v: A = None
        self.txt = txt

i = A("i")
f = B("f")
j = C("j")
d = D("d")
n = E("n")
m = F("m")
b = G("b")
g = H("g")

i.w = g
i.x = f
i.q = b
f.q = g
f.t = i
f.w = i
f.s = n
f.r = j
f.z = d
j.y = g
j.u = n
j.t = n
j.o = n
j.s = d
j.r = m
j.w = m
d.p = j
d.o = i
d.z = f
d.v = f
d.q = g
d.w = m
n.y = g
n.v = g
n.x = b
n.r = f
m.s = i
m.t = i
m.r = d
m.z = f
m.y = f
m.w = n
m.v = g
m.o = b
b.p = d
b.y = g
g.p = b
g.z = i
g.v = i
g.s = n
g.u = n
assert i.q.p.q.s.v.v.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: H = None
        self.x: B = None
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.t: A = None
        self.w: A = None
        self.s: E = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.u: E = None
        self.t: E = None
        self.s: D = None
        self.r: F = None
        self.o: E = None
        self.w: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: H = None
        self.x: G = None
        self.r: B = None
        self.v: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: D = None
        self.z: B = None
        self.y: B = None
        self.w: E = None
        self.t: A = None
        self.v: H = None
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.z: A = None
        self.s: E = None
        self.u: E = None
        self.v: A = None
        self.txt = txt

i = A("i")
f = B("f")
j = C("j")
d = D("d")
n = E("n")
m = F("m")
b = G("b")
g = H("g")

i.w = g
i.x = f
i.q = b
f.q = g
f.t = i
f.w = i
f.s = n
f.r = j
f.z = d
j.y = g
j.u = n
j.t = n
j.o = n
j.s = d
j.r = m
j.w = m
d.p = j
d.o = i
d.z = f
d.v = f
d.q = g
d.w = m
n.y = g
n.v = g
n.x = b
n.r = f
m.s = i
m.t = i
m.r = d
m.z = f
m.y = f
m.w = n
m.v = g
m.o = b
b.p = d
b.y = g
g.p = b
g.z = i
g.v = i
g.s = n
g.u = n
assert i.q.p.q.s.v.v.w.p.txt == "b"