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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: G = None
        self.y: C = None
        self.v: A = None
        self.u: B = None
        self.t: B = None
        self.x: B = None
        self.txt = txt

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

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

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

a = A("a")
m = B("m")
k = C("k")
j = D("j")
n = E("n")
i = F("i")
d = G("d")

a.u = k
m.q = k
k.v = j
k.z = j
j.p = m
j.u = m
j.t = m
j.x = m
j.w = d
j.y = k
j.v = a
n.u = j
n.w = d
n.z = d
i.r = a
d.r = m
d.q = m
d.t = m
d.x = j
d.u = i
d.v = i
d.y = a
assert j.w.r.q.z.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: G = None
        self.y: C = None
        self.v: A = None
        self.u: B = None
        self.t: B = None
        self.x: B = None
        self.txt = txt

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

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

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

a = A("a")
m = B("m")
k = C("k")
j = D("j")
n = E("n")
i = F("i")
d = G("d")

a.u = k
m.q = k
k.v = j
k.z = j
j.p = m
j.u = m
j.t = m
j.x = m
j.w = d
j.y = k
j.v = a
n.u = j
n.w = d
n.z = d
i.r = a
d.r = m
d.q = m
d.t = m
d.x = j
d.u = i
d.v = i
d.y = a
assert j.w.r.q.z.v.u.v.txt == "j"