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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: G = None
        self.p: E = None
        self.u: C = None
        self.txt = txt

h = A("h")
k = B("k")
a = C("a")
m = D("m")
j = E("j")
g = F("g")
b = G("b")
f = G("f")

h.t = g
h.w = j
k.y = h
k.q = j
k.t = a
a.p = f
a.q = m
m.s = g
m.u = g
m.w = h
m.o = b
m.y = a
j.r = a
g.u = h
g.s = a
g.o = f
b.v = a
b.u = a
b.q = f
b.p = j
f.v = a
f.u = a
f.q = b
f.p = j
assert b.p.r.q.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: G = None
        self.p: E = None
        self.u: C = None
        self.txt = txt

h = A("h")
k = B("k")
a = C("a")
m = D("m")
j = E("j")
g = F("g")
b = G("b")
f = G("f")

h.t = g
h.w = j
k.y = h
k.q = j
k.t = a
a.p = f
a.q = m
m.s = g
m.u = g
m.w = h
m.o = b
m.y = a
j.r = a
g.u = h
g.s = a
g.o = f
b.v = a
b.u = a
b.q = f
b.p = j
f.v = a
f.u = a
f.q = b
f.p = j
assert b.p.r.q.w.w.r.txt == "a"