class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: E = None
        self.x: D = None
        self.u: F = None
        self.t: D = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.o: E = None
        self.v: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: D = None
        self.q: C = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

n = A("n")
c = B("c")
k = C("k")
l = D("l")
a = E("a")
b = F("b")
f = D("f")

n.p = b
n.u = b
n.v = a
n.x = f
n.t = l
n.w = k
c.q = k
c.p = n
c.v = n
c.o = a
k.q = l
k.w = l
k.s = f
k.t = a
k.o = a
k.u = a
l.p = b
l.s = f
l.q = k
l.t = c
a.r = b
b.p = n
b.r = k
b.q = l
b.s = c
b.t = f
f.p = b
f.s = l
f.q = k
f.t = c
assert n.w.t.r.q.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: E = None
        self.x: D = None
        self.u: F = None
        self.t: D = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.o: E = None
        self.v: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: D = None
        self.q: C = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

n = A("n")
c = B("c")
k = C("k")
l = D("l")
a = E("a")
b = F("b")
f = D("f")

n.p = b
n.u = b
n.v = a
n.x = f
n.t = l
n.w = k
c.q = k
c.p = n
c.v = n
c.o = a
k.q = l
k.w = l
k.s = f
k.t = a
k.o = a
k.u = a
l.p = b
l.s = f
l.q = k
l.t = c
a.r = b
b.p = n
b.r = k
b.q = l
b.s = c
b.t = f
f.p = b
f.s = l
f.q = k
f.t = c
assert n.w.t.r.q.q.w.txt == "l"