class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: H = None
        self.u: F = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: E = None
        self.p: D = None
        self.y: A = None
        self.s: I = None
        self.q: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: I = None
        self.t: B = None
        self.w: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: H = None
        self.z: C = None
        self.o: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

h = A("h")
d = B("d")
e = C("e")
c = D("c")
l = E("l")
g = F("g")
m = G("m")
b = H("b")
n = I("n")
f = H("f")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: E = None
        self.p: D = None
        self.y: A = None
        self.s: I = None
        self.q: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: I = None
        self.t: B = None
        self.w: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: H = None
        self.z: C = None
        self.o: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

h = A("h")
d = B("d")
e = C("e")
c = D("c")
l = E("l")
g = F("g")
m = G("m")
b = H("b")
n = I("n")
f = H("f")

h.q = g
h.u = g
h.p = f
h.x = d
d.t = h
d.p = c
d.z = m
e.r = l
e.y = c
c.x = f
c.v = g
l.s = g
g.x = l
g.o = l
g.p = c
g.q = c
g.y = h
g.s = n
m.q = n
m.t = d
m.w = e
b.p = l
b.r = f
b.z = e
b.o = n
n.p = g
f.p = l
f.r = b
f.z = e
f.o = n
assert m.w.r.s.p.v.s.p.x.s.txt == "g"