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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: E = None
        self.v: G = None
        self.s: G = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: E = None
        self.v: G = None
        self.s: G = None
        self.o: E = None
        self.txt = txt

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

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

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