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

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: F = None
        self.o: G = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

j = A("j")
i = B("i")
h = C("h")
a = D("a")
d = E("d")
l = F("l")
f = G("f")
e = E("e")
g = A("g")
b = F("b")

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

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: F = None
        self.o: G = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

j = A("j")
i = B("i")
h = C("h")
a = D("a")
d = E("d")
l = F("l")
f = G("f")
e = E("e")
g = A("g")
b = F("b")

j.w = a
i.o = f
h.o = g
h.s = j
a.v = i
a.u = i
a.p = i
a.t = h
a.q = j
d.u = i
d.t = b
d.o = f
d.p = j
l.p = i
f.p = h
f.s = h
e.u = i
e.t = b
e.o = f
e.p = g
g.w = a
b.p = i
assert a.t.s.w.u.o.p.s.w.txt == "a"