class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: C = None
        self.r: G = None
        self.o: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: A = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: B = None
        self.t: B = None
        self.z: F = None
        self.u: B = None
        self.o: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: A = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: B = None
        self.t: B = None
        self.z: F = None
        self.u: B = None
        self.o: F = None
        self.txt = txt

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

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