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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: B = None
        self.t: D = None
        self.v: A = None
        self.txt = txt

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

g = A("g")
e = B("e")
i = C("i")
j = D("j")
b = C("b")
n = D("n")
k = A("k")
l = A("l")

g.u = k
g.z = b
g.t = e
g.w = l
e.w = j
i.o = j
i.u = e
i.t = n
i.v = k
j.q = e
b.o = n
b.u = e
b.t = j
b.v = g
n.q = e
k.u = l
k.w = l
k.z = i
k.t = e
l.u = k
l.z = b
l.t = e
l.w = g
assert i.o.q.w.q.w.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: C = None
        self.t: B = None
        self.w: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: B = None
        self.t: D = None
        self.v: A = None
        self.txt = txt

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

g = A("g")
e = B("e")
i = C("i")
j = D("j")
b = C("b")
n = D("n")
k = A("k")
l = A("l")

g.u = k
g.z = b
g.t = e
g.w = l
e.w = j
i.o = j
i.u = e
i.t = n
i.v = k
j.q = e
b.o = n
b.u = e
b.t = j
b.v = g
n.q = e
k.u = l
k.w = l
k.z = i
k.t = e
l.u = k
l.z = b
l.t = e
l.w = g
assert i.o.q.w.q.w.q.w.txt == "j"