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

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

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

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

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

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

e = A("e")
g = B("g")
j = C("j")
m = D("m")
d = E("d")
f = F("f")
a = C("a")

e.u = d
e.w = g
g.x = f
g.s = m
g.t = m
j.y = g
j.x = g
m.p = a
m.s = d
m.w = g
d.w = a
f.r = g
f.t = e
f.o = m
f.s = m
f.w = a
a.y = g
a.x = g
assert e.u.w.y.x.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

e = A("e")
g = B("g")
j = C("j")
m = D("m")
d = E("d")
f = F("f")
a = C("a")

e.u = d
e.w = g
g.x = f
g.s = m
g.t = m
j.y = g
j.x = g
m.p = a
m.s = d
m.w = g
d.w = a
f.r = g
f.t = e
f.o = m
f.s = m
f.w = a
a.y = g
a.x = g
assert e.u.w.y.x.w.x.txt == "g"