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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: G = None
        self.u: F = None
        self.r: F = None
        self.v: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: C = None
        self.o: F = None
        self.t: G = None
        self.u: G = None
        self.s: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: G = None
        self.u: F = None
        self.r: F = None
        self.v: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: C = None
        self.o: F = None
        self.t: G = None
        self.u: G = None
        self.s: C = None
        self.txt = txt

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

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