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

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

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

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

b = A("b")
a = B("a")
c = C("c")
n = D("n")
g = A("g")
f = B("f")
l = D("l")

b.w = l
b.q = g
b.y = n
b.v = c
a.t = c
a.s = f
a.z = f
a.u = b
c.o = l
n.x = f
n.s = f
n.r = c
n.w = g
g.w = l
g.y = l
g.q = b
g.v = c
f.t = c
f.s = a
f.z = a
f.u = b
l.x = f
l.s = a
l.r = c
l.w = b
assert l.r.o.r.o.r.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: A = None
        self.y: D = None
        self.v: C = None
        self.txt = txt

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

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

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

b = A("b")
a = B("a")
c = C("c")
n = D("n")
g = A("g")
f = B("f")
l = D("l")

b.w = l
b.q = g
b.y = n
b.v = c
a.t = c
a.s = f
a.z = f
a.u = b
c.o = l
n.x = f
n.s = f
n.r = c
n.w = g
g.w = l
g.y = l
g.q = b
g.v = c
f.t = c
f.s = a
f.z = a
f.u = b
l.x = f
l.s = a
l.r = c
l.w = b
assert l.r.o.r.o.r.o.r.txt == "c"