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

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

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

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

f = A("f")
i = B("i")
k = C("k")
e = D("e")
l = D("l")
d = A("d")
m = D("m")
c = D("c")
b = D("b")
a = C("a")

f.v = k
f.w = b
f.r = b
f.x = e
i.t = d
i.u = k
k.w = a
k.v = a
k.u = a
k.r = b
e.o = f
l.o = f
d.v = k
d.w = b
d.r = b
d.x = m
m.o = f
c.o = d
b.o = d
a.w = k
a.v = k
a.u = k
a.r = m
assert i.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.r: D = None
        self.x: D = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
k = C("k")
e = D("e")
l = D("l")
d = A("d")
m = D("m")
c = D("c")
b = D("b")
a = C("a")

f.v = k
f.w = b
f.r = b
f.x = e
i.t = d
i.u = k
k.w = a
k.v = a
k.u = a
k.r = b
e.o = f
l.o = f
d.v = k
d.w = b
d.r = b
d.x = m
m.o = f
c.o = d
b.o = d
a.w = k
a.v = k
a.u = k
a.r = m
assert i.u.u.u.u.txt == "a"