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

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

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

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

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

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

e = A("e")
d = B("d")
c = C("c")
f = D("f")
h = E("h")
k = F("k")
n = B("n")
l = C("l")
i = B("i")
a = D("a")

e.q = l
d.z = k
d.r = f
d.u = f
d.s = e
d.t = h
c.s = l
f.q = l
h.x = i
h.u = e
k.v = i
k.o = l
k.y = c
k.x = n
k.u = e
n.z = k
n.r = a
n.s = e
n.t = h
n.u = f
l.s = c
i.z = k
i.r = a
i.u = a
i.s = e
i.t = h
a.q = c
assert d.s.q.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

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

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

e = A("e")
d = B("d")
c = C("c")
f = D("f")
h = E("h")
k = F("k")
n = B("n")
l = C("l")
i = B("i")
a = D("a")

e.q = l
d.z = k
d.r = f
d.u = f
d.s = e
d.t = h
c.s = l
f.q = l
h.x = i
h.u = e
k.v = i
k.o = l
k.y = c
k.x = n
k.u = e
n.z = k
n.r = a
n.s = e
n.t = h
n.u = f
l.s = c
i.z = k
i.r = a
i.u = a
i.s = e
i.t = h
a.q = c
assert d.s.q.s.s.s.s.s.txt == "c"