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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: A = None
        self.s: G = None
        self.u: D = None
        self.t: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.o: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

a = A("a")
d = B("d")
e = C("e")
i = D("i")
g = E("g")
m = F("m")
l = G("l")
k = E("k")
n = A("n")
h = B("h")

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: A = None
        self.s: G = None
        self.u: D = None
        self.t: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.o: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

a = A("a")
d = B("d")
e = C("e")
i = D("i")
g = E("g")
m = F("m")
l = G("l")
k = E("k")
n = A("n")
h = B("h")

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