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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: B = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: F = None
        self.r: A = None
        self.w: A = None
        self.z: C = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

m = A("m")
n = B("n")
a = C("a")
e = D("e")
c = E("c")
l = F("l")
i = B("i")
b = A("b")
j = D("j")

m.q = l
n.x = l
n.q = c
n.u = j
a.r = l
a.s = b
a.z = m
e.w = c
e.y = c
e.v = n
e.r = j
c.t = m
c.w = m
c.x = l
c.s = l
c.r = b
c.z = a
l.q = c
i.x = l
i.q = c
i.u = e
b.q = l
j.w = c
j.y = c
j.v = i
j.r = e
assert i.u.w.r.q.q.r.q.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: B = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: F = None
        self.r: A = None
        self.w: A = None
        self.z: C = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

m = A("m")
n = B("n")
a = C("a")
e = D("e")
c = E("c")
l = F("l")
i = B("i")
b = A("b")
j = D("j")

m.q = l
n.x = l
n.q = c
n.u = j
a.r = l
a.s = b
a.z = m
e.w = c
e.y = c
e.v = n
e.r = j
c.t = m
c.w = m
c.x = l
c.s = l
c.r = b
c.z = a
l.q = c
i.x = l
i.q = c
i.u = e
b.q = l
j.w = c
j.y = c
j.v = i
j.r = e
assert i.u.w.r.q.q.r.q.q.r.txt == "b"