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

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

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

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

i = A("i")
h = B("h")
l = C("l")
g = D("g")
c = C("c")
a = A("a")

i.q = a
i.y = a
i.v = a
i.o = a
h.t = g
h.v = g
h.q = l
l.r = g
l.p = c
g.t = c
g.y = c
g.q = l
g.u = h
c.r = g
c.p = l
a.q = i
a.y = i
a.v = i
a.o = i
assert a.y.o.y.y.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: A = None
        self.v: A = None
        self.o: A = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
l = C("l")
g = D("g")
c = C("c")
a = A("a")

i.q = a
i.y = a
i.v = a
i.o = a
h.t = g
h.v = g
h.q = l
l.r = g
l.p = c
g.t = c
g.y = c
g.q = l
g.u = h
c.r = g
c.p = l
a.q = i
a.y = i
a.v = i
a.o = i
assert a.y.o.y.y.v.o.txt == "a"