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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: F = None
        self.p: F = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
a = C("a")
f = D("f")
j = E("j")
h = F("h")
c = G("c")
b = C("b")
g = A("g")

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: F = None
        self.p: F = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
a = C("a")
f = D("f")
j = E("j")
h = F("h")
c = G("c")
b = C("b")
g = A("g")

l.q = j
n.z = j
a.v = f
a.x = b
f.y = j
f.x = h
f.p = h
j.v = n
h.p = f
h.o = j
h.r = b
c.u = n
c.z = f
c.s = f
c.p = f
c.x = f
c.q = l
c.w = j
b.v = f
b.x = a
g.q = j
assert c.q.q.v.z.v.z.v.z.v.txt == "n"