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

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: D = None
        self.y: H = None
        self.t: G = None
        self.r: B = None
        self.o: B = None
        self.q: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: D = None
        self.y: H = None
        self.t: G = None
        self.r: B = None
        self.o: B = None
        self.q: B = None
        self.x: A = None
        self.txt = txt

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

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

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