class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: B = None
        self.o: A = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

b.v = k
b.r = d
b.o = j
b.q = i
d.r = g
i.s = g
i.u = g
i.v = h
g.t = d
h.z = i
h.r = m
h.y = b
h.t = g
n.z = i
n.r = d
n.y = j
n.t = g
m.r = g
j.v = b
j.o = b
j.r = d
j.q = l
k.v = b
k.r = d
k.o = j
k.q = l
l.s = g
l.u = g
l.v = h
assert j.o.o.v.o.v.o.txt == "j"