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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: B = None
        self.v: B = None
        self.u: C = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: B = None
        self.v: B = None
        self.u: C = None
        self.z: E = None
        self.txt = txt

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

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