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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: A = None
        self.u: B = None
        self.p: B = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
g = C("g")
n = D("n")
e = E("e")
l = F("l")

m.q = e
m.v = n
b.z = g
b.o = e
b.w = e
b.x = n
b.p = m
g.q = e
g.x = e
g.t = l
g.u = n
n.w = e
n.y = m
n.u = b
n.p = b
e.v = m
e.u = b
l.o = e
assert n.u.w.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: A = None
        self.u: B = None
        self.p: B = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
g = C("g")
n = D("n")
e = E("e")
l = F("l")

m.q = e
m.v = n
b.z = g
b.o = e
b.w = e
b.x = n
b.p = m
g.q = e
g.x = e
g.t = l
g.u = n
n.w = e
n.y = m
n.u = b
n.p = b
e.v = m
e.u = b
l.o = e
assert n.u.w.v.v.txt == "n"