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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: A = None
        self.v: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: C = None
        self.z: C = None
        self.v: E = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: A = None
        self.v: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: C = None
        self.z: C = None
        self.v: E = None
        self.s: C = None
        self.txt = txt

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

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