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

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

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

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

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

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

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

f.w = j
d.s = a
k.r = l
j.o = f
j.w = g
j.q = b
j.u = d
l.t = f
l.s = m
g.s = b
g.v = j
a.w = j
i.t = a
i.s = m
b.s = g
b.v = j
m.t = a
m.s = l
assert g.s.v.o.w.w.v.w.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

f.w = j
d.s = a
k.r = l
j.o = f
j.w = g
j.q = b
j.u = d
l.t = f
l.s = m
g.s = b
g.v = j
a.w = j
i.t = a
i.s = m
b.s = g
b.v = j
m.t = a
m.s = l
assert g.s.v.o.w.w.v.w.s.v.txt == "j"