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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: E = None
        self.u: E = None
        self.r: B = None
        self.t: F = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: E = None
        self.u: E = None
        self.r: B = None
        self.t: F = None
        self.x: F = None
        self.txt = txt

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

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

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