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

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

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

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

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

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

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

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

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

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

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

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

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

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

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