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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: E = None
        self.p: D = None
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: A = None
        self.p: B = None
        self.txt = txt

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

a.u = i
a.v = d
a.z = n
a.w = m
g.y = n
g.r = m
g.u = a
g.x = f
g.o = d
d.v = m
d.y = m
d.z = m
d.p = i
b.r = g
b.v = i
b.u = a
m.v = a
f.y = n
f.p = n
f.r = a
n.y = g
n.r = m
n.u = a
n.x = f
n.o = d
i.r = g
i.v = b
i.u = a
assert m.v.u.u.w.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: C = None
        self.z: B = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: E = None
        self.p: D = None
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: A = None
        self.p: B = None
        self.txt = txt

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

a.u = i
a.v = d
a.z = n
a.w = m
g.y = n
g.r = m
g.u = a
g.x = f
g.o = d
d.v = m
d.y = m
d.z = m
d.p = i
b.r = g
b.v = i
b.u = a
m.v = a
f.y = n
f.p = n
f.r = a
n.y = g
n.r = m
n.u = a
n.x = f
n.o = d
i.r = g
i.v = b
i.u = a
assert m.v.u.u.w.v.w.v.txt == "a"