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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: B = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: B = None
        self.x: B = None
        self.txt = txt

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

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

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

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

e.y = k
e.w = k
e.q = j
e.v = j
e.z = d
j.r = e
n.s = e
n.y = j
n.x = j
d.p = k
d.z = e
d.x = j
k.v = e
k.x = n
k.z = j
f.r = j
assert e.v.r.z.p.v.q.txt == "j"