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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: E = None
        self.t: F = None
        self.w: E = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: D = None
        self.s: F = None
        self.v: F = None
        self.r: C = None
        self.txt = txt

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

n.q = g
n.u = g
n.v = d
n.z = l
n.o = a
a.u = e
f.w = g
g.r = d
g.s = k
g.w = k
g.t = l
g.p = n
k.u = n
k.q = d
l.z = a
l.p = g
l.s = d
l.v = d
l.r = f
e.w = g
d.z = a
d.p = g
d.s = l
d.v = l
d.r = f
assert g.t.s.z.u.w.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: F = None
        self.z: F = None
        self.o: B = None
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: E = None
        self.t: F = None
        self.w: E = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: D = None
        self.s: F = None
        self.v: F = None
        self.r: C = None
        self.txt = txt

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

n.q = g
n.u = g
n.v = d
n.z = l
n.o = a
a.u = e
f.w = g
g.r = d
g.s = k
g.w = k
g.t = l
g.p = n
k.u = n
k.q = d
l.z = a
l.p = g
l.s = d
l.v = d
l.r = f
e.w = g
d.z = a
d.p = g
d.s = l
d.v = l
d.r = f
assert g.t.s.z.u.w.r.r.txt == "f"