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

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

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

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

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

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

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

f.w = h
f.q = d
j.x = h
j.p = h
j.r = m
j.u = c
j.y = g
j.s = e
h.q = d
h.r = g
h.s = g
e.q = j
e.p = j
e.u = k
e.w = f
d.o = f
m.s = h
m.x = h
g.q = k
g.u = k
g.p = k
g.w = f
k.x = h
k.p = h
k.r = m
k.u = m
k.y = g
k.s = g
c.s = h
c.x = h
assert d.o.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

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

f.w = h
f.q = d
j.x = h
j.p = h
j.r = m
j.u = c
j.y = g
j.s = e
h.q = d
h.r = g
h.s = g
e.q = j
e.p = j
e.u = k
e.w = f
d.o = f
m.s = h
m.x = h
g.q = k
g.u = k
g.p = k
g.w = f
k.x = h
k.p = h
k.r = m
k.u = m
k.y = g
k.s = g
c.s = h
c.x = h
assert d.o.w.s.w.txt == "f"