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

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

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

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

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

a.o = k
a.q = b
a.v = c
a.y = e
f.u = a
e.r = j
e.u = h
e.s = h
j.r = e
j.w = g
b.r = l
b.u = f
b.s = h
k.u = a
l.r = c
l.w = g
c.r = l
c.u = h
c.s = h
h.u = a
g.r = b
g.w = l
assert l.r.r.r.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: C = None
        self.v: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

a.o = k
a.q = b
a.v = c
a.y = e
f.u = a
e.r = j
e.u = h
e.s = h
j.r = e
j.w = g
b.r = l
b.u = f
b.s = h
k.u = a
l.r = c
l.w = g
c.r = l
c.u = h
c.s = h
h.u = a
g.r = b
g.w = l
assert l.r.r.r.s.u.txt == "a"