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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: A = None
        self.w: E = None
        self.r: G = None
        self.q: E = None
        self.v: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: G = None
        self.s: C = None
        self.w: G = None
        self.r: F = None
        self.y: C = None
        self.u: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: F = None
        self.y: D = None
        self.w: B = None
        self.v: F = None
        self.t: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.w: G = None
        self.q: G = None
        self.v: D = None
        self.x: A = None
        self.o: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: A = None
        self.w: E = None
        self.r: G = None
        self.q: E = None
        self.v: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: G = None
        self.s: C = None
        self.w: G = None
        self.r: F = None
        self.y: C = None
        self.u: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: F = None
        self.y: D = None
        self.w: B = None
        self.v: F = None
        self.t: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.w: G = None
        self.q: G = None
        self.v: D = None
        self.x: A = None
        self.o: D = None
        self.txt = txt

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

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