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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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