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

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

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.v: D = None
        self.q: D = None
        self.y: H = None
        self.p: G = None
        self.txt = txt

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

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

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

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

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

a = A("a")
d = B("d")
c = C("c")
e = D("e")
j = E("j")
n = F("n")
m = G("m")
l = H("l")

a.v = e
d.p = e
d.u = e
c.u = l
c.y = l
c.v = e
c.q = e
c.p = m
e.p = d
j.u = c
j.x = c
j.w = a
j.r = a
j.s = n
n.v = m
n.p = c
m.v = e
m.u = e
m.x = e
m.z = c
m.p = c
m.w = a
m.q = a
m.s = n
l.y = j
l.q = d
assert j.x.p.s.p.v.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.v: D = None
        self.q: D = None
        self.y: H = None
        self.p: G = None
        self.txt = txt

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

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

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

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

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

a = A("a")
d = B("d")
c = C("c")
e = D("e")
j = E("j")
n = F("n")
m = G("m")
l = H("l")

a.v = e
d.p = e
d.u = e
c.u = l
c.y = l
c.v = e
c.q = e
c.p = m
e.p = d
j.u = c
j.x = c
j.w = a
j.r = a
j.s = n
n.v = m
n.p = c
m.v = e
m.u = e
m.x = e
m.z = c
m.p = c
m.w = a
m.q = a
m.s = n
l.y = j
l.q = d
assert j.x.p.s.p.v.p.u.p.txt == "d"