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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: B = None
        self.p: E = None
        self.s: E = None
        self.y: E = None
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: B = None
        self.txt = txt

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

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

d.q = i
b.z = d
b.x = h
a.r = b
a.z = b
a.p = l
a.s = l
a.y = n
a.o = d
i.s = b
i.y = k
h.r = l
h.z = b
k.t = l
l.r = h
l.z = b
n.r = l
n.z = b
j.r = b
j.z = b
j.p = n
j.s = h
j.y = l
j.o = d
c.r = b
c.z = b
c.p = l
c.y = l
c.s = n
c.o = d
assert k.t.r.z.z.q.s.z.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: B = None
        self.p: E = None
        self.s: E = None
        self.y: E = None
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: B = None
        self.txt = txt

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

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

d.q = i
b.z = d
b.x = h
a.r = b
a.z = b
a.p = l
a.s = l
a.y = n
a.o = d
i.s = b
i.y = k
h.r = l
h.z = b
k.t = l
l.r = h
l.z = b
n.r = l
n.z = b
j.r = b
j.z = b
j.p = n
j.s = h
j.y = l
j.o = d
c.r = b
c.z = b
c.p = l
c.y = l
c.s = n
c.o = d
assert k.t.r.z.z.q.s.z.q.y.txt == "k"