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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.s: B = None
        self.y: E = None
        self.r: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: F = None
        self.x: E = None
        self.y: A = None
        self.o: A = None
        self.txt = txt

k = A("k")
a = B("a")
d = C("d")
j = D("j")
f = E("f")
c = F("c")
e = G("e")
m = A("m")
l = E("l")

k.q = e
k.x = m
a.y = m
a.q = e
a.z = d
d.w = m
j.o = f
j.y = f
j.s = a
j.r = c
f.w = k
f.u = k
f.r = c
f.x = c
f.y = c
f.q = e
f.t = d
c.p = e
e.s = j
e.t = c
e.x = f
e.y = k
e.o = m
m.q = e
m.x = k
l.w = m
l.r = c
l.x = c
l.y = c
l.q = e
l.u = k
l.t = d
assert j.r.p.t.p.o.x.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.s: B = None
        self.y: E = None
        self.r: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: F = None
        self.x: E = None
        self.y: A = None
        self.o: A = None
        self.txt = txt

k = A("k")
a = B("a")
d = C("d")
j = D("j")
f = E("f")
c = F("c")
e = G("e")
m = A("m")
l = E("l")

k.q = e
k.x = m
a.y = m
a.q = e
a.z = d
d.w = m
j.o = f
j.y = f
j.s = a
j.r = c
f.w = k
f.u = k
f.r = c
f.x = c
f.y = c
f.q = e
f.t = d
c.p = e
e.s = j
e.t = c
e.x = f
e.y = k
e.o = m
m.q = e
m.x = k
l.w = m
l.r = c
l.x = c
l.y = c
l.q = e
l.u = k
l.t = d
assert j.r.p.t.p.o.x.x.q.txt == "e"