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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.r: F = None
        self.o: D = None
        self.x: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

a.w = i
a.s = g
a.v = j
j.p = m
j.w = m
j.r = i
j.q = i
j.o = g
j.x = g
f.o = g
g.s = l
e.x = g
e.w = g
e.u = i
e.r = i
i.x = f
m.x = g
m.w = g
m.u = i
m.r = i
l.o = g
assert f.o.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: D = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.r: F = None
        self.o: D = None
        self.x: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

a.w = i
a.s = g
a.v = j
j.p = m
j.w = m
j.r = i
j.q = i
j.o = g
j.x = g
f.o = g
g.s = l
e.x = g
e.w = g
e.u = i
e.r = i
i.x = f
m.x = g
m.w = g
m.u = i
m.r = i
l.o = g
assert f.o.s.o.txt == "g"