class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: C = None
        self.q: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.o: G = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.w: A = None
        self.x: E = None
        self.t: E = None
        self.p: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.v: C = None
        self.s: A = None
        self.y: G = None
        self.p: F = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: F = None
        self.x: A = None
        self.s: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.o: G = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.w: A = None
        self.x: E = None
        self.t: E = None
        self.p: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.v: C = None
        self.s: A = None
        self.y: G = None
        self.p: F = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: F = None
        self.x: A = None
        self.s: F = None
        self.txt = txt

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

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

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