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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: D = None
        self.r: F = None
        self.y: D = None
        self.u: E = None
        self.q: A = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
k = C("k")
f = D("f")
e = E("e")
l = F("l")
h = D("h")
i = B("i")
g = A("g")
c = F("c")

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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: D = None
        self.r: F = None
        self.y: D = None
        self.u: E = None
        self.q: A = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
k = C("k")
f = D("f")
e = E("e")
l = F("l")
h = D("h")
i = B("i")
g = A("g")
c = F("c")

j.p = k
n.w = i
n.q = i
n.x = e
n.s = c
n.u = k
k.x = j
k.z = h
k.y = h
k.r = l
k.u = e
k.q = g
f.u = k
e.y = n
e.o = i
e.q = h
l.x = c
h.u = k
i.w = n
i.q = n
i.x = e
i.s = l
i.u = k
g.p = k
c.x = l
assert n.q.q.q.s.x.x.x.x.txt == "l"