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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: E = None
        self.o: A = None
        self.z: A = None
        self.s: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

j.q = m
f.x = l
f.t = e
f.o = j
f.z = n
f.s = g
f.w = d
l.x = i
l.u = f
l.q = g
g.x = j
e.q = f
e.z = d
e.y = a
e.v = a
i.u = d
a.q = f
a.z = l
a.y = e
a.v = e
m.u = l
d.x = m
d.u = f
d.q = g
n.q = i
assert m.u.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: E = None
        self.o: A = None
        self.z: A = None
        self.s: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

j.q = m
f.x = l
f.t = e
f.o = j
f.z = n
f.s = g
f.w = d
l.x = i
l.u = f
l.q = g
g.x = j
e.q = f
e.z = d
e.y = a
e.v = a
i.u = d
a.q = f
a.z = l
a.y = e
a.v = e
m.u = l
d.x = m
d.u = f
d.q = g
n.q = i
assert m.u.u.s.txt == "g"