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

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

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

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

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

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

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

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

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

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

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

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

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

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

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