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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: B = None
        self.x: D = None
        self.r: D = None
        self.s: D = None
        self.txt = txt

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

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

j.y = m
j.q = i
e.z = d
e.q = m
i.o = d
i.y = e
n.q = j
n.p = j
n.o = d
n.y = d
n.z = f
f.u = m
f.z = e
f.x = n
f.r = n
f.s = n
d.p = j
d.x = n
k.q = j
k.p = j
k.o = d
k.y = d
k.z = f
m.o = d
m.y = e
assert m.y.z.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: B = None
        self.x: D = None
        self.r: D = None
        self.s: D = None
        self.txt = txt

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

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

j.y = m
j.q = i
e.z = d
e.q = m
i.o = d
i.y = e
n.q = j
n.p = j
n.o = d
n.y = d
n.z = f
f.u = m
f.z = e
f.x = n
f.r = n
f.s = n
d.p = j
d.x = n
k.q = j
k.p = j
k.o = d
k.y = d
k.z = f
m.o = d
m.y = e
assert m.y.z.x.q.txt == "j"