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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: D = None
        self.u: C = None
        self.txt = txt

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

e = A("e")
n = B("n")
k = C("k")
h = D("h")
b = E("b")
c = F("c")
g = E("g")
d = D("d")
a = B("a")

e.p = b
n.q = e
n.r = c
n.y = b
n.z = d
k.r = d
h.o = e
h.u = c
h.r = c
b.w = h
b.r = h
b.u = k
c.w = a
c.u = h
c.o = h
g.w = h
g.r = d
g.u = k
d.o = e
d.u = c
d.r = c
a.q = e
a.r = c
a.y = b
a.z = d
assert c.w.y.u.r.r.u.o.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: D = None
        self.u: C = None
        self.txt = txt

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

e = A("e")
n = B("n")
k = C("k")
h = D("h")
b = E("b")
c = F("c")
g = E("g")
d = D("d")
a = B("a")

e.p = b
n.q = e
n.r = c
n.y = b
n.z = d
k.r = d
h.o = e
h.u = c
h.r = c
b.w = h
b.r = h
b.u = k
c.w = a
c.u = h
c.o = h
g.w = h
g.r = d
g.u = k
d.o = e
d.u = c
d.r = c
a.q = e
a.r = c
a.y = b
a.z = d
assert c.w.y.u.r.r.u.o.p.u.txt == "k"