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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.w: E = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.w: E = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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