class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: C = None
        self.q: F = None
        self.x: C = None
        self.z: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: A = None
        self.t: B = None
        self.q: G = None
        self.z: F = None
        self.r: C = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: A = None
        self.t: B = None
        self.q: G = None
        self.z: F = None
        self.r: C = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

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