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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: C = None
        self.q: E = None
        self.r: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: H = None
        self.r: G = None
        self.x: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

a.x = m
l.p = a
j.w = g
j.p = m
c.x = m
c.q = m
c.s = j
c.r = d
m.q = f
m.u = k
m.r = g
m.x = a
f.s = l
f.r = l
f.p = c
f.u = k
g.v = l
k.t = j
d.x = m
d.q = m
d.s = j
d.r = c
h.t = j
assert j.w.v.p.x.q.s.p.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: C = None
        self.q: E = None
        self.r: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: H = None
        self.r: G = None
        self.x: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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