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

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

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

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

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

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

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

n.o = c
n.x = c
n.u = a
n.v = m
b.p = m
b.s = i
b.x = a
b.u = a
b.o = d
b.q = d
d.p = b
i.w = b
c.v = m
c.s = n
c.w = a
a.v = n
m.p = b
m.s = i
m.x = a
m.u = a
m.o = d
m.q = d
assert n.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: F = None
        self.x: E = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

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

n.o = c
n.x = c
n.u = a
n.v = m
b.p = m
b.s = i
b.x = a
b.u = a
b.o = d
b.q = d
d.p = b
i.w = b
c.v = m
c.s = n
c.w = a
a.v = n
m.p = b
m.s = i
m.x = a
m.u = a
m.o = d
m.q = d
assert n.v.u.v.txt == "n"