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

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: C = None
        self.x: B = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: E = None
        self.y: A = None
        self.txt = txt

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

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

e = A("e")
k = B("k")
m = C("m")
j = D("j")
f = E("f")
l = F("l")
d = C("d")
b = C("b")
n = D("n")

e.q = k
e.t = j
k.o = e
k.y = l
k.q = m
m.s = b
m.y = b
m.x = k
m.r = l
j.x = n
j.p = f
j.y = e
f.w = e
l.x = f
l.s = f
l.y = k
l.t = n
d.s = b
d.y = b
d.x = k
d.r = l
b.s = d
b.y = d
b.x = k
b.r = l
n.x = j
n.p = f
n.y = e
assert k.q.s.r.x.w.q.o.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: C = None
        self.x: B = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: E = None
        self.y: A = None
        self.txt = txt

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

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

e = A("e")
k = B("k")
m = C("m")
j = D("j")
f = E("f")
l = F("l")
d = C("d")
b = C("b")
n = D("n")

e.q = k
e.t = j
k.o = e
k.y = l
k.q = m
m.s = b
m.y = b
m.x = k
m.r = l
j.x = n
j.p = f
j.y = e
f.w = e
l.x = f
l.s = f
l.y = k
l.t = n
d.s = b
d.y = b
d.x = k
d.r = l
b.s = d
b.y = d
b.x = k
b.r = l
n.x = j
n.p = f
n.y = e
assert k.q.s.r.x.w.q.o.q.q.txt == "m"