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

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

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

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

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

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

n = A("n")
d = B("d")
f = C("f")
j = D("j")
m = E("m")
e = F("e")

n.p = m
n.z = j
d.v = j
d.s = j
d.z = j
d.y = f
f.p = d
f.o = e
j.r = n
j.o = e
j.w = m
m.v = j
e.y = d
e.u = d
e.q = f
e.w = j
e.o = j
assert j.w.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

n = A("n")
d = B("d")
f = C("f")
j = D("j")
m = E("m")
e = F("e")

n.p = m
n.z = j
d.v = j
d.s = j
d.z = j
d.y = f
f.p = d
f.o = e
j.r = n
j.o = e
j.w = m
m.v = j
e.y = d
e.u = d
e.q = f
e.w = j
e.o = j
assert j.w.v.r.txt == "n"