class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: E = None
        self.v: A = None
        self.w: F = None
        self.y: E = None
        self.x: E = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.z: A = None
        self.q: G = None
        self.s: E = None
        self.o: C = None
        self.p: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: D = None
        self.t: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: E = None
        self.v: A = None
        self.w: F = None
        self.y: E = None
        self.x: E = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.z: A = None
        self.q: G = None
        self.s: E = None
        self.o: C = None
        self.p: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: D = None
        self.t: B = None
        self.txt = txt

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

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