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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

f.s = b
f.w = b
f.o = d
g.y = b
g.w = c
g.u = f
g.x = d
b.x = m
b.w = d
b.q = d
m.t = c
m.x = c
m.w = c
m.y = b
m.q = d
c.x = n
d.z = f
k.y = b
k.w = c
k.u = j
k.x = d
n.s = b
n.w = b
n.o = d
j.s = b
j.w = b
j.o = d
assert k.x.z.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: C = None
        self.o: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

f.s = b
f.w = b
f.o = d
g.y = b
g.w = c
g.u = f
g.x = d
b.x = m
b.w = d
b.q = d
m.t = c
m.x = c
m.w = c
m.y = b
m.q = d
c.x = n
d.z = f
k.y = b
k.w = c
k.u = j
k.x = d
n.s = b
n.w = b
n.o = d
j.s = b
j.w = b
j.o = d
assert k.x.z.w.w.txt == "d"