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

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

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

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

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

j.x = a
j.u = a
j.v = g
h.z = f
a.v = h
a.w = h
a.r = i
a.o = f
i.w = l
f.z = h
l.v = h
l.w = f
l.o = f
l.r = i
g.x = l
g.v = j
g.u = a
assert l.v.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: A = None
        self.u: C = None
        self.txt = txt

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

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

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

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

j.x = a
j.u = a
j.v = g
h.z = f
a.v = h
a.w = h
a.r = i
a.o = f
i.w = l
f.z = h
l.v = h
l.w = f
l.o = f
l.r = i
g.x = l
g.v = j
g.u = a
assert l.v.z.z.z.z.z.z.txt == "h"