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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.z: A = None
        self.s: D = None
        self.q: F = None
        self.txt = txt

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

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

m.u = d
m.q = n
m.r = n
m.z = i
m.y = i
m.w = g
f.t = i
f.o = d
g.y = b
g.s = f
g.p = d
k.p = c
k.w = m
k.z = i
d.o = b
d.t = m
d.z = m
d.s = h
d.q = i
i.v = d
i.q = h
n.t = i
n.o = d
c.p = k
c.w = m
c.z = i
h.p = k
h.w = m
h.z = i
b.y = g
b.s = f
b.p = d
assert f.t.q.p.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: B = None
        self.r: B = None
        self.z: F = None
        self.y: F = None
        self.w: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.z: A = None
        self.s: D = None
        self.q: F = None
        self.txt = txt

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

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

m.u = d
m.q = n
m.r = n
m.z = i
m.y = i
m.w = g
f.t = i
f.o = d
g.y = b
g.s = f
g.p = d
k.p = c
k.w = m
k.z = i
d.o = b
d.t = m
d.z = m
d.s = h
d.q = i
i.v = d
i.q = h
n.t = i
n.o = d
c.p = k
c.w = m
c.z = i
h.p = k
h.w = m
h.z = i
b.y = g
b.s = f
b.p = d
assert f.t.q.p.w.r.txt == "n"