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

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

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

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

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

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

g.v = l
e.t = f
l.s = e
l.q = c
l.o = f
f.r = l
j.r = d
j.q = c
j.s = l
h.v = l
d.r = l
k.v = l
c.r = f
c.q = j
c.s = l
assert e.t.r.o.r.o.r.o.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

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

g.v = l
e.t = f
l.s = e
l.q = c
l.o = f
f.r = l
j.r = d
j.q = c
j.s = l
h.v = l
d.r = l
k.v = l
c.r = f
c.q = j
c.s = l
assert e.t.r.o.r.o.r.o.r.q.txt == "c"