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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: E = None
        self.p: B = None
        self.v: H = None
        self.w: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
e = C("e")
k = D("k")
c = E("c")
f = F("f")
b = G("b")
d = H("d")
n = H("n")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: E = None
        self.p: B = None
        self.v: H = None
        self.w: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
e = C("e")
k = D("k")
c = E("c")
f = F("f")
b = G("b")
d = H("d")
n = H("n")

h.w = k
h.p = k
a.r = e
e.x = a
k.s = a
k.p = a
k.t = c
k.v = d
k.w = b
c.p = e
c.x = e
c.s = d
f.p = h
b.w = a
b.r = c
b.o = f
b.u = h
b.p = h
d.u = c
d.p = n
d.q = n
d.r = h
d.w = h
d.s = h
d.v = f
n.u = c
n.p = d
n.q = d
n.r = h
n.w = h
n.s = h
n.v = f
assert h.p.t.p.x.r.x.r.txt == "e"