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

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.w: A = None
        self.s: F = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: C = None
        self.u: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

a.o = i
a.r = i
a.q = g
a.p = l
a.w = c
a.t = h
i.q = c
h.v = l
h.w = a
h.s = g
h.q = g
m.x = g
m.v = g
m.o = h
m.u = c
c.v = a
c.u = g
c.r = e
c.w = e
c.s = h
c.o = h
g.r = l
l.r = m
l.w = a
e.p = f
e.r = d
d.v = a
d.u = g
d.r = e
d.w = f
d.s = h
d.o = h
f.p = e
f.r = d
assert d.s.q.r.r.v.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: F = None
        self.r: B = None
        self.p: G = None
        self.w: E = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.w: A = None
        self.s: F = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: C = None
        self.u: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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