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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: A = None
        self.w: H = None
        self.u: B = None
        self.s: C = None
        self.t: A = None
        self.z: A = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.p: D = None
        self.v: E = None
        self.u: H = None
        self.o: H = None
        self.x: A = None
        self.r: A = None
        self.txt = txt

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

h = A("h")
d = B("d")
k = C("k")
l = D("l")
g = E("g")
m = F("m")
a = G("a")
n = H("n")
b = F("b")

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: A = None
        self.w: H = None
        self.u: B = None
        self.s: C = None
        self.t: A = None
        self.z: A = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.p: D = None
        self.v: E = None
        self.u: H = None
        self.o: H = None
        self.x: A = None
        self.r: A = None
        self.txt = txt

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

h = A("h")
d = B("d")
k = C("k")
l = D("l")
g = E("g")
m = F("m")
a = G("a")
n = H("n")
b = F("b")

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