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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: F = None
        self.w: G = None
        self.q: A = None
        self.t: F = None
        self.v: A = None
        self.y: A = None
        self.u: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.o: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: A = None
        self.t: H = None
        self.txt = txt

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

k = A("k")
g = B("g")
e = C("e")
i = D("i")
h = E("h")
m = F("m")
d = G("d")
c = H("c")

k.q = e
g.x = c
g.p = d
e.w = i
e.q = g
i.z = m
i.r = m
i.t = m
i.w = d
i.q = k
i.v = k
i.y = k
i.u = h
h.x = k
m.u = i
m.o = i
m.q = k
d.v = h
d.y = k
d.t = c
c.u = g
assert g.x.u.x.u.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: F = None
        self.w: G = None
        self.q: A = None
        self.t: F = None
        self.v: A = None
        self.y: A = None
        self.u: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.o: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: A = None
        self.t: H = None
        self.txt = txt

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

k = A("k")
g = B("g")
e = C("e")
i = D("i")
h = E("h")
m = F("m")
d = G("d")
c = H("c")

k.q = e
g.x = c
g.p = d
e.w = i
e.q = g
i.z = m
i.r = m
i.t = m
i.w = d
i.q = k
i.v = k
i.y = k
i.u = h
h.x = k
m.u = i
m.o = i
m.q = k
d.v = h
d.y = k
d.t = c
c.u = g
assert g.x.u.x.u.p.y.txt == "k"