class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.r: F = None
        self.t: B = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: E = None
        self.s: D = None
        self.x: B = None
        self.u: E = None
        self.o: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: A = None
        self.x: C = None
        self.txt = txt

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

n = A("n")
g = B("g")
c = C("c")
f = D("f")
i = E("i")
e = F("e")
a = A("a")
j = B("j")

n.q = a
n.x = i
n.r = e
n.v = e
n.t = j
g.u = e
c.r = n
c.p = i
c.u = i
c.s = f
c.o = f
c.x = g
f.w = e
i.t = f
i.q = n
i.x = c
e.w = c
e.o = g
a.q = n
a.x = i
a.r = e
a.v = e
a.t = g
j.u = e
assert g.u.w.r.r.w.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.r: F = None
        self.t: B = None
        self.v: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: E = None
        self.s: D = None
        self.x: B = None
        self.u: E = None
        self.o: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: A = None
        self.x: C = None
        self.txt = txt

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

n = A("n")
g = B("g")
c = C("c")
f = D("f")
i = E("i")
e = F("e")
a = A("a")
j = B("j")

n.q = a
n.x = i
n.r = e
n.v = e
n.t = j
g.u = e
c.r = n
c.p = i
c.u = i
c.s = f
c.o = f
c.x = g
f.w = e
i.t = f
i.q = n
i.x = c
e.w = c
e.o = g
a.q = n
a.x = i
a.r = e
a.v = e
a.t = g
j.u = e
assert g.u.w.r.r.w.o.w.txt == "e"