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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: F = None
        self.txt = txt

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

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

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

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

n = A("n")
c = B("c")
a = C("a")
e = D("e")
d = E("d")
j = F("j")

n.v = c
n.w = c
n.u = e
n.z = d
c.t = d
c.z = j
a.w = j
a.q = c
e.r = c
e.t = c
d.z = j
d.s = c
d.o = c
d.w = n
j.o = d
assert c.t.w.v.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.u: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: F = None
        self.txt = txt

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

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

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

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

n = A("n")
c = B("c")
a = C("a")
e = D("e")
d = E("d")
j = F("j")

n.v = c
n.w = c
n.u = e
n.z = d
c.t = d
c.z = j
a.w = j
a.q = c
e.r = c
e.t = c
d.z = j
d.s = c
d.o = c
d.w = n
j.o = d
assert c.t.w.v.t.w.txt == "n"