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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

k = A("k")
m = B("m")
j = C("j")
g = D("g")
i = E("i")
a = F("a")
d = C("d")
l = D("l")

k.z = l
k.u = a
m.z = g
j.s = k
j.r = i
j.p = m
g.p = i
g.y = i
g.t = a
i.p = j
a.q = j
a.o = i
a.z = m
d.s = k
d.r = i
d.p = m
l.p = i
l.y = i
l.t = a
assert g.t.o.p.s.u.q.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

k = A("k")
m = B("m")
j = C("j")
g = D("g")
i = E("i")
a = F("a")
d = C("d")
l = D("l")

k.z = l
k.u = a
m.z = g
j.s = k
j.r = i
j.p = m
g.p = i
g.y = i
g.t = a
i.p = j
a.q = j
a.o = i
a.z = m
d.s = k
d.r = i
d.p = m
l.p = i
l.y = i
l.t = a
assert g.t.o.p.s.u.q.r.p.txt == "j"