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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: F = None
        self.q: F = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: D = None
        self.q: D = None
        self.u: E = None
        self.x: D = None
        self.txt = txt

l = A("l")
g = B("g")
f = C("f")
d = D("d")
i = E("i")
a = F("a")
b = G("b")
m = D("m")

l.u = d
l.w = d
l.x = g
l.y = g
l.p = g
l.s = b
l.z = f
g.p = f
g.t = a
g.q = a
g.o = i
g.z = d
f.z = i
f.u = l
f.t = b
d.q = b
d.z = g
d.t = g
d.x = i
d.w = i
d.v = l
i.t = g
a.z = g
b.r = f
b.v = d
b.q = d
b.u = i
b.x = m
m.q = b
m.z = g
m.t = g
m.x = i
m.w = i
m.v = l
assert l.z.u.w.z.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: B = None
        self.s: G = None
        self.y: B = None
        self.z: C = None
        self.w: D = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: F = None
        self.q: F = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: D = None
        self.q: D = None
        self.u: E = None
        self.x: D = None
        self.txt = txt

l = A("l")
g = B("g")
f = C("f")
d = D("d")
i = E("i")
a = F("a")
b = G("b")
m = D("m")

l.u = d
l.w = d
l.x = g
l.y = g
l.p = g
l.s = b
l.z = f
g.p = f
g.t = a
g.q = a
g.o = i
g.z = d
f.z = i
f.u = l
f.t = b
d.q = b
d.z = g
d.t = g
d.x = i
d.w = i
d.v = l
i.t = g
a.z = g
b.r = f
b.v = d
b.q = d
b.u = i
b.x = m
m.q = b
m.z = g
m.t = g
m.x = i
m.w = i
m.v = l
assert l.z.u.w.z.z.v.z.txt == "f"