class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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