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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.x: C = None
        self.o: F = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: B = None
        self.y: B = None
        self.v: F = None
        self.z: E = None
        self.p: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.x: C = None
        self.o: F = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: B = None
        self.y: B = None
        self.v: F = None
        self.z: E = None
        self.p: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: C = None
        self.txt = txt

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

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

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