class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: F = None
        self.x: D = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: F = None
        self.x: D = None
        self.q: E = None
        self.txt = txt

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

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

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

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

k.w = h
i.v = h
i.r = h
i.q = j
i.t = k
i.y = k
a.x = m
a.y = i
h.w = k
h.t = i
h.o = i
h.y = j
h.r = j
c.u = i
c.p = f
c.x = h
c.q = d
f.s = k
f.u = g
j.p = m
m.o = d
d.u = i
d.p = f
d.x = h
d.q = c
g.x = m
g.y = i
assert a.x.o.u.r.r.p.o.u.txt == "i"