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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: D = None
        self.x: E = None
        self.z: B = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: D = None
        self.x: E = None
        self.z: B = None
        self.y: F = None
        self.txt = txt

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

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

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