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

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: E = None
        self.z: B = None
        self.t: F = None
        self.u: E = None
        self.v: B = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.r: H = None
        self.s: E = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: G = None
        self.u: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: C = None
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: B = None
        self.o: F = None
        self.w: C = None
        self.u: D = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: G = None
        self.w: C = None
        self.v: C = None
        self.txt = txt

k = A("k")
c = B("c")
a = C("a")
d = D("d")
b = E("b")
i = F("i")
m = G("m")
e = H("e")
g = B("g")

k.r = d
k.u = b
c.p = g
c.z = g
c.v = g
c.s = b
c.u = b
c.t = i
c.w = m
a.v = e
a.r = e
a.s = b
a.w = m
d.t = g
d.y = m
d.u = m
b.q = d
b.v = a
b.s = c
i.z = c
i.x = m
i.v = d
i.u = e
m.p = d
m.u = d
m.r = g
m.o = i
m.w = a
m.v = k
e.u = m
e.p = m
e.w = a
e.v = a
g.p = c
g.z = c
g.v = c
g.s = b
g.u = b
g.t = i
g.w = m
assert g.w.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: E = None
        self.z: B = None
        self.t: F = None
        self.u: E = None
        self.v: B = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.r: H = None
        self.s: E = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: G = None
        self.u: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: C = None
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: B = None
        self.o: F = None
        self.w: C = None
        self.u: D = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: G = None
        self.w: C = None
        self.v: C = None
        self.txt = txt

k = A("k")
c = B("c")
a = C("a")
d = D("d")
b = E("b")
i = F("i")
m = G("m")
e = H("e")
g = B("g")

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