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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: C = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
n = C("n")
j = D("j")
i = E("i")
k = F("k")
f = B("f")
d = E("d")
h = A("h")
c = F("c")

b.q = c
b.z = i
a.u = b
a.o = c
a.z = f
a.y = n
n.x = a
n.s = h
n.o = j
j.o = k
j.v = n
i.u = c
k.q = j
k.u = n
k.o = c
f.u = h
f.o = k
f.z = a
f.y = n
d.u = c
h.q = c
h.z = i
c.q = j
c.u = n
c.o = k
assert j.v.s.q.u.o.o.u.s.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: C = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
n = C("n")
j = D("j")
i = E("i")
k = F("k")
f = B("f")
d = E("d")
h = A("h")
c = F("c")

b.q = c
b.z = i
a.u = b
a.o = c
a.z = f
a.y = n
n.x = a
n.s = h
n.o = j
j.o = k
j.v = n
i.u = c
k.q = j
k.u = n
k.o = c
f.u = h
f.o = k
f.z = a
f.y = n
d.u = c
h.q = c
h.z = i
c.q = j
c.u = n
c.o = k
assert j.v.s.q.u.o.o.u.s.q.q.txt == "j"