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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: A = None
        self.q: B = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: C = None
        self.v: D = None
        self.y: D = None
        self.txt = txt

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

j.z = f
j.q = k
l.r = f
l.q = a
k.w = n
k.r = f
k.y = e
n.r = j
n.x = e
e.y = l
e.q = l
e.z = j
e.x = a
a.p = f
a.o = k
a.v = n
a.y = n
f.z = j
f.q = k
assert j.q.w.x.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: A = None
        self.q: B = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: C = None
        self.v: D = None
        self.y: D = None
        self.txt = txt

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

j.z = f
j.q = k
l.r = f
l.q = a
k.w = n
k.r = f
k.y = e
n.r = j
n.x = e
e.y = l
e.q = l
e.z = j
e.x = a
a.p = f
a.o = k
a.v = n
a.y = n
f.z = j
f.q = k
assert j.q.w.x.y.q.txt == "a"