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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: D = None
        self.u: E = None
        self.y: D = None
        self.w: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: E = None
        self.p: B = None
        self.txt = txt

j = A("j")
d = B("d")
e = C("e")
g = D("g")
h = E("h")
b = F("b")
n = A("n")
a = D("a")

j.p = e
j.q = b
j.u = a
j.r = d
d.t = h
d.p = j
d.s = e
d.q = e
e.r = d
e.q = g
e.u = h
e.w = h
e.y = a
g.y = h
g.o = h
g.t = e
g.z = b
g.w = d
h.v = j
h.y = d
b.w = h
b.u = h
b.p = d
n.p = e
n.q = b
n.u = a
n.r = d
a.y = h
a.o = h
a.t = e
a.z = b
a.w = d
assert a.o.y.s.y.t.q.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: F = None
        self.u: D = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: D = None
        self.u: E = None
        self.y: D = None
        self.w: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: E = None
        self.p: B = None
        self.txt = txt

j = A("j")
d = B("d")
e = C("e")
g = D("g")
h = E("h")
b = F("b")
n = A("n")
a = D("a")

j.p = e
j.q = b
j.u = a
j.r = d
d.t = h
d.p = j
d.s = e
d.q = e
e.r = d
e.q = g
e.u = h
e.w = h
e.y = a
g.y = h
g.o = h
g.t = e
g.z = b
g.w = d
h.v = j
h.y = d
b.w = h
b.u = h
b.p = d
n.p = e
n.q = b
n.u = a
n.r = d
a.y = h
a.o = h
a.t = e
a.z = b
a.w = d
assert a.o.y.s.y.t.q.z.p.txt == "d"