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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

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

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

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

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

g.q = m
g.o = f
d.q = g
d.x = g
d.w = l
d.r = e
d.t = e
h.z = l
f.w = g
f.z = g
f.q = l
e.r = g
l.y = e
l.z = f
l.o = f
l.r = m
l.t = h
l.q = j
m.v = g
m.t = j
m.p = h
j.v = h
j.r = h
j.y = d
assert g.o.w.o.w.o.q.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

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

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

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

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

g.q = m
g.o = f
d.q = g
d.x = g
d.w = l
d.r = e
d.t = e
h.z = l
f.w = g
f.z = g
f.q = l
e.r = g
l.y = e
l.z = f
l.o = f
l.r = m
l.t = h
l.q = j
m.v = g
m.t = j
m.p = h
j.v = h
j.r = h
j.y = d
assert g.o.w.o.w.o.q.r.p.txt == "h"