class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.u: D = None
        self.p: E = None
        self.z: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.y: F = None
        self.p: B = None
        self.txt = txt

j = A("j")
e = B("e")
c = C("c")
n = D("n")
k = E("k")
g = F("g")
h = G("h")
b = G("b")

j.q = b
j.z = b
j.u = n
j.p = k
e.s = h
e.p = b
c.w = n
n.r = j
k.u = j
k.x = g
g.w = e
h.z = e
h.p = e
h.s = n
h.y = g
b.z = e
b.p = e
b.s = n
b.y = g
assert n.r.z.y.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.u: D = None
        self.p: E = None
        self.z: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.y: F = None
        self.p: B = None
        self.txt = txt

j = A("j")
e = B("e")
c = C("c")
n = D("n")
k = E("k")
g = F("g")
h = G("h")
b = G("b")

j.q = b
j.z = b
j.u = n
j.p = k
e.s = h
e.p = b
c.w = n
n.r = j
k.u = j
k.x = g
g.w = e
h.z = e
h.p = e
h.s = n
h.y = g
b.z = e
b.p = e
b.s = n
b.y = g
assert n.r.z.y.w.p.txt == "b"