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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.s: B = None
        self.x: G = None
        self.y: D = None
        self.u: H = None
        self.z: F = None
        self.q: E = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: A = None
        self.q: G = 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.r: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.s: B = None
        self.x: G = None
        self.y: D = None
        self.u: H = None
        self.z: F = None
        self.q: E = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: A = None
        self.q: G = 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.r: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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