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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

l.z = m
f.q = k
f.z = k
f.x = m
f.w = n
i.x = n
a.u = l
a.p = l
a.v = l
a.r = k
a.z = k
a.s = i
a.q = n
m.o = l
m.w = a
m.x = a
m.z = n
k.x = l
k.q = l
k.r = f
n.y = i
assert f.w.y.x.y.x.y.txt == "i"