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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: E = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: E = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

j.q = a
j.p = l
d.r = a
d.s = n
d.z = l
l.u = h
l.p = h
l.x = j
a.q = j
a.u = i
i.q = g
i.z = g
g.u = l
g.o = l
g.t = i
g.v = h
f.q = g
f.z = g
n.r = a
n.s = d
n.z = l
h.r = a
h.s = n
h.z = l
assert f.z.u.x.q.q.txt == "j"