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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: F = None
        self.q: G = None
        self.t: F = None
        self.v: G = None
        self.r: C = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
m = C("m")
n = D("n")
a = E("a")
d = F("d")
e = G("e")
f = H("f")

g.p = a
g.v = m
g.u = f
k.s = f
k.o = n
k.w = g
k.q = d
m.q = g
m.u = e
m.x = n
n.r = e
a.x = k
a.s = d
a.t = d
a.q = e
a.v = e
a.r = m
d.s = k
d.y = e
e.r = d
e.x = n
f.x = a
assert d.s.w.p.s.y.r.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.u: H = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: F = None
        self.q: G = None
        self.t: F = None
        self.v: G = None
        self.r: C = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
m = C("m")
n = D("n")
a = E("a")
d = F("d")
e = G("e")
f = H("f")

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