class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.x: D = None
        self.o: F = None
        self.v: D = None
        self.w: D = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: G = None
        self.t: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: I = None
        self.u: F = None
        self.v: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: I = None
        self.z: A = None
        self.p: C = None
        self.y: H = None
        self.r: B = None
        self.s: G = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.y: I = None
        self.o: F = None
        self.z: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: G = None
        self.t: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: I = None
        self.u: F = None
        self.v: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: I = None
        self.z: A = None
        self.p: C = None
        self.y: H = None
        self.r: B = None
        self.s: G = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.y: I = None
        self.o: F = None
        self.z: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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