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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: C = None
        self.x: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: G = None
        self.p: A = None
        self.o: F = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: H = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: C = None
        self.x: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: G = None
        self.p: A = None
        self.o: F = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: H = None
        self.txt = txt

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

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

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

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