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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.v: F = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
b = C("b")
l = D("l")
f = E("f")
g = F("g")
n = G("n")
j = A("j")
d = C("d")

a.t = b
h.x = g
h.q = b
h.y = n
h.s = n
h.r = n
b.q = f
b.s = n
b.v = h
l.t = g
l.s = g
l.w = g
l.r = h
l.u = h
l.q = a
l.p = a
f.s = g
f.v = g
g.p = n
g.u = f
g.z = f
g.x = h
g.q = h
g.s = d
n.z = a
j.t = d
d.q = f
d.s = n
d.v = h
assert n.z.t.q.s.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.v: F = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
b = C("b")
l = D("l")
f = E("f")
g = F("g")
n = G("n")
j = A("j")
d = C("d")

a.t = b
h.x = g
h.q = b
h.y = n
h.s = n
h.r = n
b.q = f
b.s = n
b.v = h
l.t = g
l.s = g
l.w = g
l.r = h
l.u = h
l.q = a
l.p = a
f.s = g
f.v = g
g.p = n
g.u = f
g.z = f
g.x = h
g.q = h
g.s = d
n.z = a
j.t = d
d.q = f
d.s = n
d.v = h
assert n.z.t.q.s.p.z.txt == "a"