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

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

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

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

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

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

e = A("e")
d = B("d")
j = C("j")
b = D("b")
n = E("n")
l = F("l")

e.p = d
e.s = d
e.r = b
e.v = n
e.x = n
e.w = l
d.q = j
j.w = n
j.y = b
b.w = n
b.v = n
b.o = e
n.o = e
n.z = b
l.o = n
l.p = n
l.z = j
assert n.o.w.z.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: D = None
        self.v: E = None
        self.w: F = None
        self.s: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

e = A("e")
d = B("d")
j = C("j")
b = D("b")
n = E("n")
l = F("l")

e.p = d
e.s = d
e.r = b
e.v = n
e.x = n
e.w = l
d.q = j
j.w = n
j.y = b
b.w = n
b.v = n
b.o = e
n.o = e
n.z = b
l.o = n
l.p = n
l.z = j
assert n.o.w.z.w.z.w.txt == "n"